Sending Mail with Multiple Attachment

@zellec

Use SEND OUTLOOK MAIL MESSAGE activity , In the Attach Files ,attach your attachments

image

2 Likes

@Sob thank you for the info. but i need to send multiple attachment.

@zellec Follow below link

1 Like

HI,
option 1- you can directly give paths in the arguments of send mail activity.
option 2- read that directory and run the for loop, then we can send as many attachment we want. In the argument pass the file name that is your “item”+ remaining path.
Hope it will workMain.xaml (9.5 KB)

2 Likes

@rahul599756 i need to send all files in one message.

then go for invoke method inside for loop and pass that invoke method output into send mail argument. we can send from that. This will work.

1 Like

Thanks for the reply i just found a solution.

Main.xaml (14.3 KB)
this also u can try.

2 Likes

Hello Rahul, why are we using the type in invoke method as null ?
thanks in advance.

Thanks Rahul…The provided code is working fine.

But when I received the mail I am unable to find Email subject and body contain, what I have provided. Please your code and let us know how it should sent in email.

Thanks

Please follow the below steps:

  1. Create a variable ‘multiAttach’ of type string array.
  2. Assign multiAttach = Directory.GetFiles(“folder path”)
  3. In Send outlook mail messages, instead of attaching files use AttachmentsCollections from the properties and pass ‘multiAttach’ variable.(Please see below image)

Multiple%20Attachments

Done!!!

28 Likes

Hi

try to use assign

mailMessage.body = “xxxxxx”
mailMessage.subject = “xxxxxx”

This works like charm, thanks its saved my manual works for adding one by one image files inside the folder

Thanks Tauseef1. Best solution for the issue.

hey, i try this method on SMTP activities, but it seems dont work … did i miss something ?

2 Likes

Hi Friends

In Sending SMTP Mail you have to update the version Uipath.mail.Activities 1.9.5 then it will show you attachmentsCollection then you can attach multiple files.

1 Like

You can use a variable System.Collections.Generic.IEnumerable <System.String> and with an assign add the path of the files for sending mail. Something like this: AttachmentsCollection = {“Path file 1”, “Path file 2”}

1 Like

Thank You! It’Work

I want to send multiple attachments to multiple email ids (eg: (invoice 1 and invoice 3) to mail id 1 and (invoice 2 and invoice 5 ) to mail id 2 and so on . Can you please help me with it ??

Heres how I did it.
I have a bot that downloaded a ton of reports (small) but named “DE-XXXXX-XXX.pdf” some times there would be none, other times I could have 10. So…

First thing is to assign a ARRAY OF variable.

Then, once that MailAttachments variable is loaded, just drop it into the AttachmentCollection property of Send Outlook Mail.

I hope this helps. (and sorry if someone already posted this answer)