Getting empty email body from gmail

Hello,

I am getting an problem in reading email from gmail. I am using Get IMAP Mail Message activity and reading unread emails. Now I want to read email body and want to enter data into our site. But I am getting email body as empty. The output showing as below.

image

I used below to get email body
item.Body.ToString

Please help.
Thanks,

Please try item.Headers(“PlainText”) and see if this returns anything.

2 Likes

Thank you.
It is resolved my problem.
Can you please let me know how can I get HTML contents from email body and read html table. I am getting emails which contains data in tabular form. I want to parse those data and put them on website.
Please let me know if it is possible.

Thanks,

See https://forum.uipath.com/t/get-outlook-mail-messages-html-body/96637
This will return the whole mail body in html and you will need to make some string operations to it.

I am not using outlook. I am getting email from gmail. I need to read html table. is it possible to find html element in a string.

Use mail.Headers(“HTMLBody”) , it doesn’t matter if you’re using outlook or something else.

Ok. Thank you.

Then can I read contents as html like find an element by tag name. if it is possible, please let me know how?

Then the returned body would look something like <div dir=\"ltr\">rarararara</div>\r\n in a string variable, for example.

firstly use mail.Headers(“HTMLBody”) and then convert that in mail.Headers(“plaintext”). it will be working

1 Like

Thanks , That Worked for me . But still I am receiving blank message box at start and end of execution

How do i make the conversion?

Thanks a lot ! This saved my day :grin: . I had sent almost an hour searching for why I could not get only the email.Body in SMTP email, while I could retrieve the value for other elements of the email object.