+1 vote

It sometimes happens that IMail.Text property is empty.
Those emails show good in Outlook.

Is this a bug?

by

1 Answer

+1 vote
 
Best answer

It may happen that the emails you received are HTML only.

In such case IMail.Text is going to be empty, as there is no text/plain
data inside.

Use IMail.Html or IMail.GetBodyAsText in such case.

IMail email = ...
string html = mail.Html;

string plain = mail.GetBodyAsText();

IMail.GetBodyAsText returns text/plain (IMail.Text) if it's available, if not, it parses IMail.Html and extracts plain text.

by (301k points)
...