Cook Computing

MIME Encapsulation of Aggregate Documents

January 26, 2004 Written by Charles Cook

I often use the "Save as ...Web Page, single file (*.mht)" feature of IE, and have sometimes speculated about the format, though never enough to investigate it any further, until I came across a Slashdot posting yesterday which mentioned that the format is defined in RFC2557 - MIME Encapsulation of Aggregate Documents.

To give a flavour of the format, this is one of the examples from the RFC, an HTML message containing a single image:


From: foo1@bar.net
To: foo2@bar.net
Subject: A simple example
Mime-Version: 1.0
Content-Type: multipart/related; boundary="boundary-example";
        type="text/html"; start="<foo3@foo1@bar.net>"

--boundary-example
Content-Type: text/html;charset="US-ASCII"
Content-ID: <foo3@foo1@bar.net>

... text of the HTML document, which might contain a URI
referencing a resource in another body part, for example
through a statement such as:
<IMG SRC="http://www.ietf.cnri.reston.va.us/images/ietflogo.gif"
 ALT="IETF logo">
--boundary-example
Content-Location: http://www.ietf.cnri.reston.va.us/images/ietflogo.gif
Content-Type: IMAGE/GIF
Content-Transfer-Encoding: BASE64
R0lGODlhGAGgAPEAAP/////ZRaCgoAAAACH+PUNvcHlyaWdodCAoQykgMTk5
NSBJRVRGLiBVbmF1dGhvcml6ZWQgZHVwbGljYXRpb24gcHJvaGliaXRlZC4A
etc...

--boundary-example--