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?
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
item.Headers(“Date”).ToString //for date received
Item.Subject.ToString //for subject
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 :-
Sounds like you are using the right method to obtain the Subject etc but the access might be blocked. I have the same problem but its only since I updated OS from Win7 to Win10.
Hopefully you find a workaround.