How to draft an email and save that email as .eml file?

Hi everyone,

I’m trying to draft an email and save it as a .eml file. I ticked the option “IsDraft” but the email was just saved as a draft in Outlook. Is there any ways that I could save that email as a file?
Thanks in advance.

Hi @qt1211,

Create a mail message object with all the details you would like to add.
Use Save Mail Message activity to save it as a file in your local folders.

2 Likes

Hi @Madhavi,
Thanks for the answer. It worked. But can we use html format (like the option “IsBodyHtml”)?
Thank you.

Update: Just need to set “mailMessage.IsBodyHtml = True” and that worked.

When you create mailmessage object, you can set any property that mailmessage contains.
Capture

1 Like

Hi @Madhavi, I was trying to add the Recipient using “mailMessage.To = "user@gmail.com”", But there is a “Invalid L-value expression” error. Is that the right way to assign the email address?

mailMessage.To is a collection of mailAdresses. Hence you can not use assign method to directly assign email ID with datatype string.

Use invoke method and add the mailaddress as,

1 Like

Awesome. Thank you so much for your help.

My pleasure