5. Composite Media Type Values
The two composite top-level media types are: multipart and message.
5.1. Multipart Media Type
The multipart type is used to combine multiple body parts into a single message. Each part is an independent entity with its own headers and body.
5.1.1. Common Syntax
All multipart types share a common syntax. The boundary parameter is required:
Content-Type: multipart/mixed; boundary="----=_Part_0_123456789.987654321"
------=_Part_0_123456789.987654321
Content-Type: text/plain
First part content
------=_Part_0_123456789.987654321
Content-Type: text/html
<html>Second part content`</html>`
------=_Part_0_123456789.987654321--
5.1.3. Mixed Subtype
multipart/mixed is used for independent parts that need to be presented in order.
Use Case: Email body + attachments
Content-Type: multipart/mixed; boundary="boundary123"
--boundary123
Content-Type: text/plain
Email body
--boundary123
Content-Type: application/pdf
Content-Disposition: attachment; filename="document.pdf"
[PDF data]
--boundary123--
5.1.4. Alternative Subtype
multipart/alternative is used for different representations of the same content. Mail clients should select the last version they understand.
Use Case: Plain text + HTML versions
Content-Type: multipart/alternative; boundary="alt123"
--alt123
Content-Type: text/plain
Plain text version
--alt123
Content-Type: text/html
<html><body>HTML version`</body>``</html>`
--alt123--
5.1.5. Digest Subtype
multipart/digest is used for forwarding multiple messages. The default part type is message/rfc822.
5.1.6. Parallel Subtype
multipart/parallel indicates that parts should be presented simultaneously.
5.1.7. Other Multipart Subtypes
multipart/related: Related parts (e.g., HTML + embedded images)multipart/form-data: HTML form file uploadsmultipart/byteranges: HTTP range requests
5.2. Message Media Type
The message type is used to encapsulate another message.
5.2.1. RFC822 Subtype
message/rfc822 is used to encapsulate a complete RFC 822 message.
Content-Type: message/rfc822
From: [email protected]
To: [email protected]
Subject: Forwarded message
This is the forwarded message content.
5.2.2. Partial Subtype
message/partial is used to split large messages into multiple fragments.
Parameters:
id: Unique identifiernumber: Fragment numbertotal: Total number of fragments
Content-Type: message/partial;
id="[email protected]";
number=1;
total=3
5.2.3. External-Body Subtype
message/external-body is used to reference data stored elsewhere.
Access Types:
ftp: FTP serverhttp: HTTP URLlocal-file: Local filemail-server: Mail server
Content-Type: message/external-body;
access-type=URL;
URL="http://example.com/file.pdf"
Content-Type: application/pdf
Content-Description: Large PDF File
Typical Nested Structure:
multipart/mixed
├── text/plain (body)
├── multipart/alternative
│ ├── text/plain
│ └── text/html
└── application/pdf (attachment)