Hello everyone. This is my first post here.
So I am new in UIPath, but I have managed to create a complete flow.
What I find difficult is how to send an email for any error that may happen during the process.
What I have done is this:
So all the activities are in try block. But I want to send an email in case of any error in catch block.
Can anyone please help me?
If you want to send emails to notify the error,then keep the send mail activity in the catch block,and follow the below steps:
1.Place Send Outlook Mail activity inside catch Block
2.And set the properties as in below screenshot
In Subject :You can keep it as per your req
In Body:You can add
“Exception occured in Processname.Please find the exception details”+exception.message
To: Receiver’s email id
You can surround your main sequence/flowchart/state machine with a TryCatch and then add your email activity in the Catch block
Why did you post this twice? Don’t post things twice.
I thought I deleted the first one.
Thank you for the reply @geetishree.rao
That’s what I have done, but when an error happens I don’t get any email.
The catch I have used is SystemException. Is this right?
Do you have outlook installed in your system?
Keep a breakpoint in the mail activity and debug.
Check what you are getting
System.Exception is a catch-all. It will catch any type of error.
If you don’t get the email then your send email activity isn’t set up properly. And again, you should probably use Send SMTP Email. It’s simpler and doesn’t require Outlook (which causes its own problems).
Yes, I have the outlook installed.
To be more clear, if I run this process to send me an email when the process executes with no error, it works fine and I get the email.
Only inside the catch block it doesn’t send an email in case of error.
Are you sure there is an error happening that sends it to the Catch block? Have you used Debug mode to see what’s happening?
If it is sending mails then the mail functionality is fine…no probs.
As for mail alert for exceptions,are you sure you are getting an error ?
If not try to throw an exception deliberately and check.
It would be good if you could share your xaml,so that I can look into it and confirm.
Attaching a sample xaml with send mail functionality for sending emails with n without exception.
Hope this helps.
ForumExceptionMail.xaml (8.8 KB)