RPA — How to send embedded images in an outlook email using UiPath

Santan Barnwal
2 min readFeb 4, 2022

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

  1. Base64 encoded image
  2. Embedding image by attaching
  3. Linked resources
  4. 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):

Screenshot of Assign activity

Convert image to Base64:

Data Type of ImageBase64 variable : String
For converting image : Convert.ToBase64String(System.IO.File.ReadAllBytes(ImagePath))

Screenshot

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+”’/>”

Screenshot of Mail Body

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

Screenshot of the final workflow:

Screenshot of the Outlook 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

--

--

Santan Barnwal

Santan Barnwal is a lifelong learner, youtuber and a writer. He shares his knowledge and experiences to inspire others to follow their dreams.