Read a locally saved .eml file and save attachment

Could anyone help me get the attachments from .eml files saved locally inside a folder ?

The Directory.GetFiles function only returns a string and i think i need a mail collection for the SaveAttachments function to work.

Hi @Astearon

you can try to save the local email in a collection variable and then try to read the same


I have assigned Directory.GetFiles(“PATHTOMAILS”) to a variable named EmailFolder of type Array [Object]

when trying a for each item in EmailFolder:

Add to collection “Mails” of type List <MailMessages

I get an error that i cannot cast from System.String to System.Net.Mail.MailMessage

I already have the emails downloaded in a folder done outside UIPath.

How do i add emails (.eml) from a folder to a collection if the mails are already there by means outside UIPath ?