Could not get Content Type and Charset when it has multipart

Topics: Feature Requests, Help requests, Issues
Jul 18, 2014 at 5:15 AM
Edited Jul 18, 2014 at 9:05 AM
Hi Pavel,

As the topic, imapx could not get the correct type and charset when the original as belowing:
Content-Type: multipart/mixed;

Content-Type: text/html;charset="utf-8"
Content-Transfer-Encoding: 7bit
This is a multi-part message in MIME format.

Content-Type: multipart/related;

Content-Type: multipart/alternative;

Content-Type: text/plain;
Content-Transfer-Encoding: quoted-printable
Jul 18, 2014 at 4:02 PM
Edited Jul 18, 2014 at 4:03 PM
Hi tietaren,

when a message is marked as multipart, the Content-Type header of the message itself is being set to Content-Type: multipart/mixed; ..... This value is however not a valid content type in the means of System.Net.Mime.ContentType.
Moreover, such message can have multiple parts with a different Content-Type header set, so Message.ContentType is being set to null, as we cannot determine a common ContentType for whole message.

Exactly for this reason, each message body (e.g myMessage.Body.Html.ContentType) and each attachment (e.g myAttachment.ContentType) has a ContentType property, so you can retrieve the ContentType of every message part separately.

Hope this helps,


Sep 16, 2014 at 4:04 PM
Edited Sep 16, 2014 at 4:05 PM
The problem is, that if the content-type is multipart/alternative, this usually means that the message contains a html and a text version. And the client should decide, based on settings, if the html OR the text version must be shown. Not both.

best regards,