MIME messages
A MIME message consists of both data and metadata. MIME metadata consists of HTTP-style headers and MIME boundary delimiters.
MIME headers
Each header is
a colon-separated name-value pair on a line. The ASCII sequence <CR><LF>
terminates
the line. A sequence of these headers, called a header block, is terminated
by a blank line: <CR><LF><CR><LF>
. Any
headers that are in this HTTP style can appear in a MIME document.
Some common MIME headers are described in MIME standard header fields.
Content-Type
The only header that must be
present is the Content-Type header. This header
specifies the type of the data in the message. If the Content-Type
value starts with multipart
, the message is a multipart MIME
message. For multipart messages the Content-Type header must also
include a boundary attribute that gives the text that is used to delimit
the message parts. Each MIME part has its own Content-Type field that
specifies the type of the data in the part. This can also be multipart,
which allows multipart messages to be nested. MIME parts with any
other Content-Type values are handled as BLOB data.
SET OutputRoot.Properties.ContentType = 'text/plain';
Parsing
Special cases of multipart MIME
- Multipart MIME with just one part. The logical tree for the MIME part saves the Content-Type and other information as usual, but the Data element for the attachment is empty.
- Single-part MIME. For single-part MIME, the logical tree has no Parts child. The last child of the MIME tree is the Data element. The Data element is the parent of the BLOB that contains the message data.
- MIME parts with no content.
Secure MIME (S/MIME)
S/MIME is a standard for sending secure email messages. S/MIME has an outer level Content-Type of multipart/signed with parameters protocol and micalg that define the algorithms that are used to encrypt the message. One or more MIME parts can have encoded content. These parts have Content-Type values such as application/pkcs7-signature and a Content-Transfer-Encoding of base64. The MIME domain does not attempt to interpret or verify whether the message is signed.