Add different attachment to each eamil in Gmail

Hi, I want to send different attachment to each email adress by gmail.
How to do it? I have a table in excel: name, email and I have word attachements called “name”. Each user should receive email with personalised attachment.
Please help

use for each row in data table activity and in attach file set the value of arguement as currentRow(“name”)

Hi, please check below workflow, it will help you

SendMail.xaml (7.8 KB)

I can’t open it. can you send a screenshot?

@Anna_Swierczynska-Bak
Step 1: Read Excel File
Excel Application Scope (File path: “your_excel_file.xlsx”)
Read Range (Output DataTable: dt)

Step 2: Loop Through DataTable
For Each Row in dt

Step 3: Compose Email
Assign: name = row(“name”).ToString()
Assign: email = row(“email”).ToString()
Build Data Table (Output DataTable: emailDataTable)
Add Data Row (Array: {name, email}, DataTable: emailDataTable)

Step 4: Attach File
Assign: filePath = "path_to_word_files" + name + “.docx”
Attach Files (File Path: filePath)

Step 5: Send Email
Send SMTP Mail Message (To: email, Subject: “Your Subject”, Body: “Your Body”, Attachments: filePath)

@Anna_Swierczynska-Bak


follow this

Sure,

In Attached Files

you can change column name as per your excel sheet.

Is it possible to do it without data table? What i was trying to do is:

Send email: to current row - body is always the same - attachments files File<name>.docx

it only works for first row, but doesn’t for the rest :frowning:

to pickt the right attachment i wrote this:

works only for the 1st row:(

Hey, Debug it using the message box. Use the “message box” activity and make sure you’re looping it correctly. Also, you can use the “SMTP” activity instead of using “send email” activity. “SMTP” activity is much simpler and easy to use.

Solution - It turned out that my version of StudioX has some error and after I changed it sending emails with attachemnent started working correctly

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