How to pass image path in HTML body content for Email

I need to pass two images in a html template to send in email.
What is the best way VB or Create html content?
I tried using using html content activity but stuck in how to add the src id as variable & how to pass that variable ?

Hi @Ana_Patricia

you can use src tag in your body of the email content. Also please make sure to check isbody html.

you can refer the below thread.

hope it helps!!!

@Ana_Patricia,

Create html content is preferred. You will have to convert the Image to Base64 string and then pass to html.

UiPath Studio provides html editor for it also. More easy to draft emails.

Refer this thread.

Thanks,
Ashok :slight_smile:

@Ana_Patricia

Here is a 2 step way to add images

  1. Select Insert Image

image

  1. Select From file when run Option and Provide a Variable which contains the filePath

image

cheers

HI @Ana_Patricia ,

Try the below steps to convert the image to base64 and then add in your html code.

Step 1 : You can convert the image in to base64 string by using the below syntax

strDecodedImage =Convert.ToBase64String(System.IO.File.ReadAllBytes(“yourfilename.png”))

Step2: for example if your image is in data folder , use the below syntax

StrDecodedBase64 = “data:image/png;base64,”+StrDecodedImage

Step 3: Use your html code as per your requirement, I am giving an example html code to add src tag in the html code

strHTML = “

Thanks,
RPA Team

<img src=”+StrDecodedBase64+“width=‘25’ height=‘30’>

Attaching the above code screenshot for better understanding.

Hope this information helps…
Attach Image in html