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;
boundary="--=707D94D0C91D4C7EBD08_BC82_F785_34E9"

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

------=_NextPart_000_003A_01CD13DC.4EE92ED0
Content-Type: multipart/related;
type="multipart/alternative";
boundary="----=_NextPart_001_003B_01CD13DC.4EE92ED0"


------=_NextPart_001_003B_01CD13DC.4EE92ED0
Content-Type: multipart/alternative;
boundary="----=_NextPart_002_003C_01CD13DC.4EE92ED0"


------=_NextPart_002_003C_01CD13DC.4EE92ED0
Content-Type: text/plain;
charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable
Coordinator
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,

Greets,

Pavel
Sep 16, 2014 at 4:04 PM
Edited Sep 16, 2014 at 4:05 PM
Hi,
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,
Michael