How to get the attachments from a mail already saved in my computer

Hello all,

How to get attachments from a mail already downloaded and saved in my computer.

1 Like

Welcome to uipath community
Here the question is whether to retrieve the attachment from mail or get the already retrieved mail attachment from our system

So for the first case
—We need to get all the mail message as a list variable from any of the Get mail activity like Get Outlook Mail Activity or Get Exchange Mail Activity
—now use a for each loop and pass the above variable as input and. Change the type argument property as System.Net.Mail.Mailmessage in the property panel
—inside the loop use a activity called SAVE ATTACHMENT where we need to mention the mail variable as item and folder path where we need to save the attachment
—now the files in each mail will get saved in their attachment name as in mail


If we want to get the files from already downloaded folder only thing we need to know is the folder path so that we can retrieve the files from there using a simple assign activity like this
arr_filepath = Directory.GetFiles(“yourfolderpath”,”*.xlsx”)

Where arr_filepath is a string array variable
And here I have mentioned as xlsx so this expression would give us only excel files from that folder and so if pdf then *.pdf
Or if we need all files just mention folder path alone
Like this
arr_filepath = Directory.GetFiles(“yourfolderpath”)

Hope this would help you
Cheers @gabyhm92

Thanks Palaniyappan, I already performed the steps that you already mentioned, I already downloaded the attachments from a mail and saved in my computer, but those attachments are mails too, and those mails contains attachments, so, I want to extract those attachments, any idea?