Read saved email to object return null Subject, Body and Headers

Hi All,

I am using Read saved email to object from UiPath connect to read contents from a .eml File.

It returns a System.Net.Mail.Message object, but I am unable to get its header and body information.

For example, lets say the returned Mail Message object is email, using Message box activity on above object as

email.Headers(“subject”) or email.Subject returns null. Same while accessing Sender, CC and Body information.

How to successfully read these contents?

Best Regards

1 Like

To get the header and subject details we can simply use GET OUTLOOK or GET EXCHANGE or any other activities under the package UiPath.Mail.Activities

So they will give us a output of type list of mailmessages and pass them as input to FOR EACH activity and change the type argument as System.Net.Mail.MailMessage

And inside the loop use your expression
Like this
item.Headers(“Date”).ToString //for date received

Item.Subject.ToString //for subject

Cheers @nsiva

1 Like

Hi @Palaniyappan,

Thank you for your response, but my scenario is little bit different. I do not want to read the mails in Inbox and get its details. I want to get the details of a saved email (like a .eml or .msg file).

For example, someone can attach an email message (as an attachment) and send it with their email. In this case, how can I read the details of that attached email?

I am also facing exactly the same issue.
@nsiva Did you get any resolution for the same ?

In my scenario it was due to the Filepath (I had included the file name as well in the path).
This is what i passed in input parameters and it worked :-
EmailFileName:- “FileName.eml”
EmailFilepath:- “C:\foldercontainingfile”

1 Like