Mail Message Headers Issue

Hi everyone!

I have an issue with GetOutlookMailMessages activity.
As you may know, it creates a List of System.Net.MailMessage objects.
Such object has a Headers property. Using this property we can get headers info by their indexes (7 by default). So we can easily get HtmlBody header data.

The issue is next. While retrieving MailMessage objects with the GetOutlookMailMessages activity, I am not able to get HtmlBody in particular cases. Headers property in such cases has only 4 items (not 7, as required by default).

Maybe someone can give me an advice?

Thanks in advance.

Hi @aDovbysh

Welcome back! :slight_smile:

Would it make sense if the HtmlBody was simply not there for emails that use plain text instead of html for its content?
In this case, you would only need to add an extra check to see whether htmlbody exists and if not, extract the content directly from .Body of the email message.

1 Like

Thank you, my friend.

I will check this out.

@loginerror, thanks!

It works for my case. HtmlBody key is not exists in the Headers collection. Looks like such mails is in Plain Text format, as you mentioned before.

1 Like