RPA — How to send embedded images in an outlook email using UiPath
In most processes, it is required to send embedded images in emails. i.e. Sending error screenshot, Image in Email signature ….
There are multiple ways to embed an image in an email
- Base64 encoded image
- Embedding image by attaching
- Linked resources
- Image hosted on server
In this tutorial, I will explain how to embed an image in an outlook email using Base64 encoded image
Create a sequence in Project and follow below steps:
Assign image path to a variable (As shown in below screenshot):
Convert image to Base64:
Data Type of ImageBase64 variable : String
For converting image : Convert.ToBase64String(System.IO.File.ReadAllBytes(ImagePath))
Create HTML Body for the email:
Data Type of variable mailBody : String
Code: “<h2>Test Email with inline image</h2>
<img height=’100' width=’100' src=’data:image/png;base64,”+ImageBase64+”’/>”
Use the ‘Send Outlook Mail Message’ activity for sending an email. Input all the required information i.e. Email id, Subject, Body and, check IsBodyHtml in properties.
Screenshot of the final workflow:
Your workflow is ready to send an email with an embedded image.
Happy Automation !!
Follow me on LinkedIn: https://www.linkedin.com/in/santanbarnwal/
Subscribe to my YouTube channel: https://www.youtube.com/channel/UCoF8-B_MfOCL40szrorbtyQ
My Website: www.santanbarnwal.com
— Santan Barnwal