How to send the mail using sendoutlook mail with dynamic content?

I want to send Birthday wish email to the user. Sending email without image is working fine for me.
But I want to send the email along with the birthday image (Birthday image between the texts) embedded in it.

Also, every time I send the email, I want to pick the image randomly from the local folder. How can I do this?

Please help me with this.


1 Like

I am using Microsoft outlook version 2010.


Please go through this link.
Embed Image in Outlook Email
To send random image you can follow the below steps.

  1. Directory.getFiles(“Local Folder path”) to get all image files and convert String to list.
  2. Generate a random number as randomNum between 0 and number of files in local directory.
  3. Get the file path at index from the list using list.Item(randomNum)
  4. Embed your image in email present at filePath.
1 Like

@Bharat, Thanks for the reply.
I have gone through the link which you have sent. It contains sending an attachment to the email, whereas I want to embed the image between the email content.

I have followed your steps to select the random image from the local folder, and it worked. Thanks a lot.

Now the same image I want to embed between the content. For which I am concatenating the fetched image between the html body content. For example, if the fetched image is stored in ‘birthDayImage’ variable, then I am concatenating it between the html content using +birthDayImage+. But the received image doesn’t show the content formatting as well as image. It shows only the image link and normal content.

Whereas it does work with outlook version 2013. I am using the version 2010. Is there any solution to make it work in 2010?

Hello Namratha,

You can try this workflow to embed an Image in body. It’s working fine for me, I have outlook 2010 installed. (42.3 KB)

I tried the same, but it sends the image as an attachment, instead of embedding the image.

I want that image above the “Happy Birthday Once again!” text.

And also formatting is also not taking place. Could you please tell me what exactly I need to do? Because everything else is working. But the formatting and image is not happening :frowning: