isBodyHtml not working as expected

I am getting Outlook mail messages.
and have to check if the body is in HTML format or not.

I tested with two mails -
1.
Text format Plain:
and am getting isBodyHtml=False

Text Format HTML:
and still am getting isBodyHtml=False

I suspect this is a bug.
Or am I doing some thing wrong?

Resturns false for me as well.

if you are struck with that I think you can validate by using BodyEncoding

Content-Type: text/plain; charset="us-ascii";
Content-Type: text/html; charset="utf-8"
1 Like

Thanks. This was great help.
But I see there are 3 types of mail formats in outlook.

  1. Plain
  2. Richtext
  3. HTML

your solution above will help me differentiate 1 & 3 but how do know if the mail was received in RichText format?
Body Encoding gives us-ascii for rich text as well. is there any other property to differentiate?

[EDIT]
The reason for this issue is that mail.BodyEncoding.EncodingName returns
utf-8 for HTML &
us-ascii for Plain as well as RTF
is there a way I can access the content-type so that I can identify the mail formats in a better way?

Can you try this?

email.AlternateViews.Item(0).ContentType.ToString

2 Likes