Content Type for MHT files

柔情痞子 提交于 2019-11-30 13:02:50

application/octet-stream

You can stream the contents of a .eml file to a browser with this content type and .mht as the extension, and the email will be rendered similar to the way it is rendered in an email client.

Microsoft, who co-authored the spec for MHT, seem to think that it should be 'message/rfc822' on this support page.

No specific MIME type seems to be given in the spec though: RFC2557: MIME Encapsulation of Aggregate Documents, such as HTML (MHTML)

I know this is old, but I thought it should be clarified and explained in more detail...

@Guy Starbuck wrote:

message/rfc822

RFC 822 - STANDARD FOR THE FORMAT OF ARPA INTERNET TEXT MESSAGES

The problem with this answer is that MHTML files are not defined by RFC822.

The correct content-type for MHTML files (.mht, .mhtml) is multipart/related.

As stated above, RFC822 defines the format for internet text messages. The content-type message/rfc822 is used for text attachments within email messages [1][2].

Most of us have probably received a reply to an email where, instead of being quoted inline, the original message is included as an attachment. That attachment has a content-type of message/rfc822. In such emails, the content-types break down as follows:

  • multipart/mixed = entire message
  • text/plain = text of reply email
  • message/rfc822 = original email as attachment

On the other hand, as noted by @feeela, MHTML files are defined in RFC2557. MHTML files are comprised of many different parts, each of which can have a different content-type. However, RFC2557 defines the content-type of the entire file as multipart/related.

[1] RFC1341: MIME (Multipurpose Internet Mail Extensions)
[2] The message Content-Type

message/rfc822

RFC 822 - STANDARD FOR THE FORMAT OF ARPA INTERNET TEXT MESSAGES

Here is a hyperlink: message/rfc822

"MIME Encapsulation of Aggregate Documents, such as HTML" (MHTML or MHT) is an IETF standard proposed in 1999 in the RFC 2557.

Its MIME type is multipart/related and the extension is .mht.

See also:

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!