How to send Random number of files using SMTP mail message activity

Hey Friends, I want to send mail with multiple attachment using SMTP, where i download multiple attachment and there will be random number of files each time.
Please help me with this.

Thanks in advance.

@aslam_ali1

Sequence:
Variables:
attachmentFilePathsList (List of String)

Assign activity: attachmentFilePathsList = Directory.GetFiles("C:\Your\Download\Path")

Try:
Send SMTP Mail Message activity:
From: “your@email.com
To: “recipient@email.com
Subject: “Multiple Attachments”
Body: “Please find the attachments below.”
Attachments: attachmentFilePathsList

Catch (Exception):
// Handle any exceptions that may occur during the email sending process
Log Message activity: "Error sending email: " + Exception.Message

@aslam_ali1

Get the list of files to an array and pass the array in AttachmentsCollection

@aslam_ali1

Hello,

Create a variable of type Array of String as below.

You can replace png according to your file type.

Pass Array variable to SMTP as below

Hope it helps.

Regards,
Vidya

HEY @aslam_ali1
You can give the folder path and it will send all the files that are present in that folder.
Like the below screenshot , it will send all the files which are present inside the Test folder
image

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