How to attach multiple folder files to SMTP attachment

Hi,

I have 3 different folders with multiple files, I need to attach all the files from 3 different folder to SMTP attachments, how do we do it ? please advise

Hi @monisharpa2020

Store all the file path in a collection variable and pass the Variable to the Attachment collection option in the Properties.

Check the below image for better understanding,

The collection variable should be IEnumerable of String datatype,

Hope it helps!!

@monisharpa2020

Directory.GetFiles("YourFolderpath",".*yourExtension")

@monisharpa2020


folder1Files=Directory.GetFiles("C:\Users\rlgandu\Downloads\PDF FILES").ToList()
folder2Files=Directory.GetFiles("C:\Users\rlgandu\Downloads\Sample_Test").ToList()
allFiles=folder1Files.Concat(folder2Files)

If you want to give three folders then use this to concat

allFiles =folder1Files.Concat(folder2Files).Concat(folder3Files).ToList()

Thank you, solves the issue @rlgandu

1 Like

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