Sending Mail to multiple users with attachments

Hello,

I would like to send a email to the following people from this excel file. but I have no idea how I would get started… Could someone help me? Here is a example and there are also duplicates. Also the usernames have a email to there username linked in outlook.

Kind regards,

ukjtenhoven

Hi @ukjtenhoven,

keep your data in excel sheet then use read range acitivity to read.

after you read use this command.

String emails = string.join(“;”, for each r in dt select r(“c”))

dt → your data table
c → your column name

Hi @venkat4u,

I get this error do you know why?

2 Likes

Hi @ukjtenhoven
Kindly follow the below steps that could help you resolve this issue buddy
–use excel application scope and pass the file path as input
–use read range activity and get the output with a variable of type datatable, named outdt
–Then use a remove duplicate rows activity and pass the input as outdt and get the output variable of type datatable with a variable named Final_dt
–then use a for each row loop and pass the input Final_dt to this activity
–inside the for each row loop use a if condition to check whether the row has empty value in the column C
like this
Not String.IsNullOrEmpty(row(“C”).ToString)
if this condition gets passed it will go to THEN part of if condition where you can use
send outlook mail activity, and mention the body of the mail, subject of the mail and in TO property mention the value as row(“C”).ToString as it has the email address to whom we want to send

Thats all it will send the mail to all the recipients in the column as for each row loop will iterate through each row one by one in that column
Cheers @ukjtenhoven

can you try with this

From r in DT select r.item(“C”)

in case if you have any duplicate values then use below

From r in DT select r.item(“C”) distinct

1 Like

Hi @Palaniyappan,

So I have this now:

But I get a error could you show me how to solve that one?

Kind regards,

ukjtenhoven

use like this in the for each row loop buddy where mail_Id is the string variable that will have the mail id
image
image

Cheers @ukjtenhoven

Hi @venkat4u,

I tried it but I got this error:

Kind regards,

ukjtenhoven

1 Like

it should be like this buddy @ukjtenhoven
Not String.IsNullOrEmpty(row(“C”).ToString)

Hi @Palaniyappan,

Thanks for the quick answer! I still get this error:

Cheers,

remove that dot buddy
image
only this
Not String.IsNullOrEmpty(row(“C”).ToString)
cheers @ukjtenhoven

Hi @Palaniyappan,

Thank you it is working!

Cheers @Palaniyappan

Fantastic
Cheers @ukjtenhoven

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.