Key Concepts of MHTML

Key Concepts of MHTML

While HTML as a document format for MIME e-mail has been available for years in the form of the text/HTML content type, the richness of HTML as an interoperable e-mail format can be achieved only through the use of the MIME multipart/related content type.  This content type allows the message to contain an HTML page and other resources such as pictures and sound included directly in the MIME hierarchy of the message.  These data can be referenced through links from the HTML content and used to complete the rendering of the document. This usagelets the recipient resolve all the links "locally" — that is, without having to use the network.

MHTML defines the naming of objects that are normally referred to by URLs and the means of aggregatingresources that go together. Two MIME headers, Content-Location and Content-Base, are defined in order to resolve references to other content stored locally in related body parts. Content-Base gives an absolute URL base, or "starting point",for relative URLs that appear in other MIME headers and in HTML documents that do not contain any BASE HTML elements. Content-Location specifies the URL that corresponds to the content of the body part that contains this header.

The following example shows an MHTML message with a relative reference to an embedded GIF.

Subject: An example
Mime-Version: 1.0
Content-Type: Multipart/related; boundary="boundary-example-1";type=Text/HTML

Content-Type: Text/HTML; charset=ISO-8859-1
Content-Transfer-Encoding: QUOTED-PRINTABLE

... text of the HTML document, which might contain a hyperlink
to the other body part, for example through a statement such as:
<IMG SRC="/images/image.gif" ALT="Image">
Example of a copyright sign encoded with Quoted-Printable: =A9
Example of a copyright sign mapped onto HTML markup: &#168;

Content-Location: /images/image.gif
Content-Type: IMAGE/GIF
Content-Transfer-Encoding: BASE64


--boundary-example-1 —