Multipart
boundaryA MIME message structure that combines multiple content parts — such as plain text, HTML, and attachments — in a single message, each separated by a unique boundary string.
A multipart MIME message has a Content-Type of multipart/mixed, multipart/alternative, multipart/related, or another multipart subtype. The header specifies a boundary parameter — a unique string like "----=_Part_12345" — that appears as a delimiter between each part in the message body. Each part has its own mini-header section declaring its Content-Type, encoding, and optional filename.
The most common multipart structure for a formatted email with attachments is nested: the outer container is multipart/mixed, which holds a multipart/alternative part (containing both plain-text and HTML versions of the body) alongside one or more attachment parts. Clients choose which alternative to display based on what they support, and they offer attachments for download.
Parsing nested multipart structures correctly is one of the more complex aspects of email processing. Malformed boundary strings, missing headers, or unusual nesting can trip up simpler parsers. A robust MIME implementation must handle edge cases gracefully so that messages with non-standard structure still render usefully rather than appearing as raw text.
Related terms
Multipurpose Internet Mail Extensions — the standard that defines how email messages encode non-ASCII text, HTML bodies, attachments, and other binary content within the plain-text structure of email.
A file — such as a PDF, image, or spreadsheet — embedded in an email message and encoded as a MIME part, separate from the message body, intended for the recipient to save or open.
An image embedded directly into an HTML email body using a Content-ID (cid:) reference, rather than attached as a separate downloadable file. The image data is stored as a MIME part within the same message.