You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I have a MHTML document (with one simple image and a text) that opens in Chrome and Edge, but MimeKit parser returns an Empty HtmlBody when parsing it.
I initially thought this could be a bug in MimeKit and decided to investigate the source code and RFC2387. After further research, it looks to me that MimeKit is strictly following the standards, but Chrome and Edge are a little more “flexible” and parse a document that is incorrectly formatted.
The whole problem is the document is a “Content-Type: multipart/related” and type=”text/html”, so according to what I understood from the standards, either the first part of the document (Root) should be the HTML or a start parameter should point to the part with the appropriate “Content-ID”.
The document that I got (it was generated by DevExpress Inc. RichText control) adds the image in the first part, the HTML in the second part and uses no “start” to point to the Root. The result is MimeKit does not parse it correctly, so no HtmlBody is generated.
My suggestion would be: (1) Generate an exception when parsing an incorrectly formatted document
or (2) Be a little more flexible on the standard like Chrome and Edge and opening any way.
If it is multipart/related and text/html, I guess Chrome/Edge simply look up for the HTML part and open it correctly
I have a MHTML document (with one simple image and a text) that opens in Chrome and Edge, but MimeKit parser returns an Empty HtmlBody when parsing it.
I initially thought this could be a bug in MimeKit and decided to investigate the source code and RFC2387. After further research, it looks to me that MimeKit is strictly following the standards, but Chrome and Edge are a little more “flexible” and parse a document that is incorrectly formatted.
The whole problem is the document is a “Content-Type: multipart/related” and type=”text/html”, so according to what I understood from the standards, either the first part of the document (Root) should be the HTML or a start parameter should point to the part with the appropriate “Content-ID”.
The document that I got (it was generated by DevExpress Inc. RichText control) adds the image in the first part, the HTML in the second part and uses no “start” to point to the Root. The result is MimeKit does not parse it correctly, so no HtmlBody is generated.
My suggestion would be:
(1) Generate an exception when parsing an incorrectly formatted document
or
(2) Be a little more flexible on the standard like Chrome and Edge and opening any way.
If it is multipart/related and text/html, I guess Chrome/Edge simply look up for the HTML part and open it correctly
incorrect_mhtml_file.txt
The text was updated successfully, but these errors were encountered: