+1 vote

When I use IMail to open email send from google or other ca not find body - is empty.


1 Answer

0 votes
Best answer

What does your code look like?

Are you looking at IMail.Text or IMail.Html property?

Some emails my contain HTML data only and no plain text representation. In such case IMail.Text is going to be empty.

Consider using IMail.GetBodyAsText method, if you want HTML-only emails to be converted to plain text:

var eml = imap.GetMessageByUID(uid);
IMail email = new MailBuilder().CreateFromEml();

string plainTextBody = email.GetBodyAsText();

IMail.GetBodyAsText uses IMail.Text if available, or converts IMail.Html or IMail.Rtf to plain text.

by (276k points)