Selecting various Images for various Mails

Hi guys,

I need to send anniversary emails to employees, so here the problem is, how do I send various images for various mails. eg:- if the person completes 1 year then I have to send an image, and if the person completes 2 years then I need to send different images, likewise I need to send till 3rd year celebration. Any solution for this…??

Any suggestion for this example will be appreciated…

1 Like

Hi Sandeep ,
Welcome to Uipath Community Forum

Can you please tell me how you are getting the Years value of that person completed how many years
So based on that can provide you the solution

1 Like

Hi Vinay,

So, I am getting data from DB, where we have columns like empid, empname, date of joining and emailid.
So, there I am using an Assign activity and assigning noofyears = convert.ToInt32(DateDiff(DateInterval.Year,joinDate,currentdate)), like this I am getting the years value.

Here what you can do is
Put all your Image files in a folder of your machine with proper naming like 1year.jpg 2year.jpg etc
Now in uipath code use for each activity with Argument type property as string
For each of Directory.getfiles(folderpath)
Now inside body of the for each you can put
Assign activity with below values
Variable Filename = item.getfilename
Then below to that use

If activity and use the condition as
Filename.split("".tochararray)(0) = NoofYears.tostring
Send outlook mail message activity
In the attachment property of send outlook mail message
Create a arguement name and give value as Item


But, here I need to embed the image to the mail, it should not send as an attachment, for that case what I did is I have used assign activity, in which I assigned the image directly to the variable(emailbody) and in the mail body I have simply added as emailbody. In this case only 1 image is send to all the mails. I need to embed the image to the mail body, not as an attachment.