Hi, I am trying to reply to an Outlook Email from a different account and not from default account. Meaning - When the receiver receives the email and when they click reply, it should point to that particular email id rather than the default account email id. When I try to do this, I get an error showing as Account Name Null exception.. But when I leave empty \ try default account email id, it is getting successful.
The email account which I am trying has proper send on behalf permissions. So, I am confused what sort of permissions \ Access I am missing here.
Actual Outlook Functionality I am trying to achieve here - Direct Replies To. Since it is applicable only in Sending SMTP and UiPath has no activity for reply SMTP mail.
You are trying to set the reply to address to a different email account which is like using the “Direct Replies To” feature in Outlook. The error happens because the UiPath Outlook activity needs that other email account to be fully set up in the local Outlook profile, even if you have “Send On Behalf” permission.
The best way to reliably set the reply-to address without needing Outlook configuration is to use the SMTP Send Mail Message activity and fill in its dedicated ReplyTo property.
@Jp_Khetan Thank you for the note. The SMTP has only Send Email activity which creates a New Email but I wanted to Reply to an existing Outlook Email. For the Send SMTP Email, I tried fetching the To, CC Addresses, Email subject, body and enter in the new email, the email body looks so congested since the old email body and new email body goes upto 50 lines(multi paragraph). So, the customer wants it as a reply functionality to have a proper view. Can we design the email body to look as actual reply email?
Since the SMTP activity only sends a new email you can make it look like a real reply by constructing the email body using HTML.
Set the IsBodyHtml property to True then add a reply header From Sent To Subject and use simple HTML styling like a gray vertical line and indentation to visually quote the original message content keeping the conversation clear for the customer
I am able to construct the email body as a Reply message with all the required parameters. But when the actual email has some Table data, and when the bot sends a new SMTP email, the data is not showing in desired format. I am using Create HTML Content to get the email body. In Send SMTP email, isbodyhtml is enabled and I pass the body as mailmessage.body and also tried with mailmessage.bodyashtml. Both did not give me the required format. Is there any more formatting to be done for the email body which we extract before we pass in to send smtp?
Can you try taking “html body” (Mail.headers(“htmlbody”)) only by reading the email in the first go. Then you dont have do formatting and all. Then on this html you can do required massaging.
To keep the table formating you must extract the original email’s HTML content not the plain text body. Change the value for your ReplyBody variable from MailMessages(0).Body to a property like MailMessages(0).Headers(“HTMLBody”) or MailMessages(0).BodyAsHtml then ensure this raw HTML is nested correctly within your custom reply structure in the Send SMTP Mail Message activity.
I tried MailMessage(0).Headers(“HTMLBody”) and it prints the HTML tags in the body of email even though I enabled “isbodyhtml” in Send SMTP mail activity.. Additionally I checked if the MailMessage(0).isbodyhtml and it returns False.
The reason you see raw HTML tags is that Headers “HTMLBody” extracts the full complex HTML source of the email.
To fix this use an Assign activity with a Regular Expression to cleanly extract only the content situated between the and tags from that raw string which preserves your table formatting without the extra clutter
The input email will be dynamic and the format is also dynamic. Is there any specific regex can be used to remove the unwanted? Or do we need to build regex based on each email format?
Since email formats are highly dynamic a single all-encompassing Regular Expression to clean the HTML is impractical. You should identify the specific recurring clutter elements like MS Office tags or font definitions in your received emails and then use a small set of targeted Regular Expressions in UiPath’s Replace function to remove only those known unwanted patterns from the body content.