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

  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):
image

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:

Test Email with inline image


<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.

image

Screenshot of the final workflow.

Your workflow is ready to send an email with an embedded image.

Happy Automation !!