Free trial The cheapest email marketing platform: try Moosend free for 30 days, no credit card. Don't miss your seat. The cheapest email marketing platform Start free trial →

RFC 2046: MIME Part Two: Media Types

Defines the media type system (text, image, audio, video, application, multipart, message).

Alaa Touil
Email infrastructure specialist, 8+ years in SMTP and deliverability
10 min read Updated Nov 9, 2026 326 views
RFC 2046 MIME Part Two: Media Types - SMTPedia reference
RFC 2046
MIME Part Two: Media Types

Current standard

Domain
MIME
Published
November 1996
Obsoletes
RFC 1521, 1522, 1590
SMTP relevance
high

↗ Read on rfc-editor.org

What this RFC defines

RFC 2046 defines the MIME media type system: the classification of content into types (text, image, audio, video, application, multipart, message) and subtypes. It introduces the multipart type, which allows a single email message to contain multiple separate content parts, each with its own headers.

Where you see it in practice

The multipart/alternative structure that lets email clients choose between your HTML and plain text versions is defined here. The multipart/mixed type used when you send an email with attachments comes from RFC 2046 section 5.1. When an email client displays an inline image embedded in an HTML email, it is navigating a multipart/related structure, defined later in RFC 2387 on top of this RFC’s multipart model.

Multipart structure

RFC 2046 defined the multipart content type, which is what allows an email to contain both a text version and an HTML version, or an HTML body plus attachments, or a mixed set of inline images and text. Each multipart message has a boundary string declared in the Content-Type header (Content-Type: multipart/mixed; boundary=”…”), and the body is split into parts separated by that boundary. Each part has its own headers (Content-Type, Content-Transfer-Encoding) and its own body. This recursive structure lets MIME represent arbitrarily complex documents.

The original multipart subtypes

RFC 2046 defined four multipart subtypes. multipart/mixed is the general case for independent parts (typical for text + attachments). multipart/alternative provides multiple representations of the same content (typical for text + HTML), and the client should render only the last part it can display. multipart/parallel is meant for content that should be rendered simultaneously (rare in email). multipart/digest is a bundle of messages (used for mailing list digests). Two subtypes every mail system uses today came later: multipart/related (RFC 2387) for HTML with inline images referenced by cid: URLs, and multipart/report (RFC 6522, originally RFC 3462) for bounces, read receipts and complaint reports.

Boundary handling pitfalls

The boundary string must not appear anywhere in the message body, or parsing fails. RFC 2046 recommends boundaries include random characters to make collision effectively impossible. Poorly-implemented libraries sometimes generate weak boundaries like —=- that legitimately appear in scientific papers or code samples, causing parts to be split incorrectly. Robust implementations generate high-entropy boundaries (typically 20+ random characters). If you see MIME parsing failures on specific messages, boundary collision or malformed boundary syntax is a leading suspect.

Quick Reference

RFC 2046 (November 1996) defines the MIME media types: the five top-level types (text, image, audio, video, application) plus the two composite types (multipart, message). Companion to RFC 2045 (which defines the MIME headers) and RFC 6838 (media type registration, which replaced RFC 2048). Introduces the multipart structure used by every attachment-carrying email, every HTML+text alternative, every DSN, MDN, and ARF report. Central concept: boundary delimiters separate parts within a multipart body.

RFC 2046 at a glance

AspectDetail
PurposeDefine MIME media types and multipart structure
Five discrete typestext, image, audio, video, application
Two composite typesmultipart, message
Multipart mechanismBoundary parameter delimits parts within body
Common multipart subtypesmixed, alternative, related, digest, parallel, report
Companion RFCsRFC 2045 headers, RFC 2047 encoded-word, RFC 6838 registration (replaced RFC 2048)
PublishedNovember 1996

The seven top-level MIME types

TypePurposeCommon subtypes
textHuman-readable textplain, html, css, csv, xml
imageStill imagesjpeg, png, gif, webp, svg+xml
audioSoundmpeg, mp4, ogg, wav
videoMoving imagesmp4, webm, ogg, quicktime
applicationNon-textual data (fallback for anything not in the above four)pdf, octet-stream, json, zip, msword
multipartComposite: multiple parts in one bodymixed, alternative, related, report, digest, parallel
messageEncapsulated message or message-like datarfc822, delivery-status, disposition-notification, feedback-report

RFC 2046 defined these seven. The list has grown since: model was added for 3D data (RFC 2077) and font for font files (RFC 8081). New subtypes are registered with IANA under the procedure of RFC 6838, which is why the official list keeps growing while email still mostly uses the seven originals.

The multipart subtypes and their semantics

SubtypeMeaningCommon use
multipart/mixedParts are independent, shown in orderMessage + attachments
multipart/alternativeParts are different representations of same content; recipient picks best-supportedPlain text + HTML pairing
multipart/relatedParts collectively make one document (HTML + inline images)HTML email with embedded images referenced by Content-ID
multipart/digestEach part is a message; default type is message/rfc822Mailing list digests
multipart/parallelParts should be displayed simultaneously (rarely implemented)Multimedia presentations (obsolete in practice)
multipart/reportStructured report (DSN, MDN, ARF) per RFC 6522Bounce messages, read receipts, complaints

Multipart body structure

multipart/mixed body structure
Content-Type: multipart/mixed; boundary=”=_NextPart_A1B2C3″

This is the preamble; it can contain any text and is ignored
by MIME-aware clients. Legacy non-MIME clients see this text.

–=_NextPart_A1B2C3
Content-Type: text/plain; charset=utf-8

First part content.

–=_NextPart_A1B2C3
Content-Type: application/pdf; name=”report.pdf”
Content-Transfer-Encoding: base64
Content-Disposition: attachment; filename=”report.pdf”

JVBERi0xLjQKJeLjz9MK…

–=_NextPart_A1B2C3–

This is the epilogue; also ignored by MIME parsers.

Structure rules:
– Boundary line: “–” + boundary parameter value
– Terminator: “–” + boundary + “–”
– Preamble and epilogue for non-MIME clients (ignored)
– Each part has its own headers followed by empty line then content

What real emails look like inside

Most emails you receive follow one of three MIME trees. You can check any message yourself: in Gmail, three-dot menu then “Show original”; in Outlook on the web, three-dot menu then “View” and “View message source”; in Apple Mail, “View”, “Message”, “Raw Source”. Search the source for Content-Type: multipart and the boundaries that follow.

EmailTypical MIME treeWhy
Newsletter or confirmation emailmultipart/alternative
  text/plain
  text/html
Same message twice; the client shows the last part it supports (HTML), text-only clients and filters read the plain part
Transactional email with inline logomultipart/alternative
  text/plain
  multipart/related
    text/html
    image/png (Content-ID)
The HTML references the logo with cid:, so logo and HTML must travel together inside related
Invoice with PDF attachedmultipart/mixed
  multipart/alternative (text + HTML)
  application/pdf (attachment)
mixed keeps the body and the attachment as independent parts, so the PDF is shown as a file
Seen on smtpedia.com. Our newsletter confirmation email used to be sent as a single text/plain part. When we rebuilt it in November 2026, we sent it as multipart/alternative with a short HTML version and a plain-text version carrying the same words and the same link, so that text-only clients, accessibility tools and spam filters all see the same message.

Common multipart mistakes

Boundary appearing in body content. RFC 2046 requires the boundary string to not appear anywhere within the body. If body content happens to contain the boundary, parsers split incorrectly. Modern generators use high-entropy boundaries (20+ random characters) to make accidental collision statistically impossible.
Missing terminator. The multipart body must end with --boundary-- (note the trailing double-dash). Omitting this makes parsers uncertain where the body ends; strict parsers reject, lenient parsers extend to end of message. Always emit the terminator.
Nested multiparts using the same boundary. If a multipart/mixed contains a multipart/alternative inside, the inner boundary MUST differ from the outer. Reusing the same boundary confuses parsers about which level the delimiter belongs to.
Confusing multipart/mixed with multipart/alternative. Mixed shows all parts (body + attachments). Alternative shows only the best-supported (plain text OR html). Using mixed for text+html duplicates content for the user; using alternative for body+attachment hides the attachment. HTML emails typically nest: multipart/mixed[multipart/alternative[text/plain, text/html], attachment].
Not handling malformed boundaries defensively. Real-world messages contain broken boundaries (trailing whitespace, missing dashes, quoted values missing terminators). Robust parsers try to recover; strict parsers reject. Choose based on your role: MTAs should be lenient inbound and strict outbound, mail clients should be lenient (users cannot fix sender’s message).

How MIME structure affects deliverability

Spam filters read the MIME tree before they read your words. A few structural choices are scored on their own.

StructureWhat filters seeWhat to do
HTML only, no text partSpamAssassin has a dedicated rule, MIME_HTML_ONLY (“Message only has text/html MIME parts”)Always send multipart/alternative with a real plain-text part
Text and HTML parts that say different thingsSpamAssassin rules MPART_ALT_DIFF and MPART_ALT_DIFF_COUNT (“HTML and text parts are different”)Generate the text part from the same content, not a one-line “view in browser” placeholder
Large attachmentsBase64 adds about a third to the size, so a 20 MB file becomes a message of about 27 MB and can exceed a 25 MB limitSend a link for big files; see our attachment size limits guide
Executable or risky attachmentsGmail blocks types such as .exe, .bat, .js, .iso, .msi or .ps1, also when they are inside a .zip or .gz, and blocks password-protected archivesShare such files through a download link instead of attaching them

Sources: Apache SpamAssassin rule set (20_body_tests.cf); Google, “File types blocked in Gmail”.

MIME family RFCs

  • RFC 2045: MIME base headers (Content-Type, Content-Transfer-Encoding, MIME-Version)
  • RFC 2047: Encoded-word syntax for non-ASCII in headers
  • RFC 2048: original media type registration procedures, replaced by RFC 4288 and then RFC 6838
  • RFC 2049: MIME conformance criteria
  • RFC 6522: multipart/report (used by DSN, MDN, ARF)
  • RFC 2183: Content-Disposition header (attachment metadata)
SMTPedia companion guides

Frequently asked questions

What is the difference between multipart/related and multipart/mixed?

multipart/related declares that the parts together form one document; typically an HTML part references inline images by Content-ID (cid:), and the images are additional parts. Mail clients render the HTML and resolve cid: references to their sibling image parts. multipart/mixed treats parts as independent; attachments are shown separately from the message body. Use multipart/related for HTML with truly inline images (logos in email templates), multipart/mixed for HTML + downloadable attachments.

Should HTML emails always include a plain text alternative?

Yes, per longstanding best practice. Wrap them in multipart/alternative: text/plain part first, text/html part second (recipient shows the last supported part, which is typically HTML). Reasons: mail clients that block HTML rendering (privacy-focused clients, accessibility tools, some corporate policies) fall back to plain text; spam filters prefer messages that offer plain text; some deliverability signals depend on the presence of both parts.

What is the preamble in a multipart body?

Text between the Content-Type header’s empty line and the first boundary. Ignored by MIME-aware parsers. Historically included messages like “This is a MIME-formatted message. If you see this text, your mail reader does not support MIME.” for pre-1996 clients. In 2026 no such clients exist, but the preamble is still legal (and sometimes used for debugging or attribution markers).

Can multipart parts contain nested multiparts?

Yes, arbitrarily deep in theory. A part can have Content-Type: multipart/anything with its own boundary and its own parts, which can themselves be multipart. Common pattern: multipart/mixed outer wrapper containing a multipart/alternative body pair and separate attachment parts. Enforce a reasonable depth limit (typically 10 or fewer) in parsers to prevent zip-bomb style attacks with deeply nested structures.

How long should a MIME boundary be?

Long enough that accidental collision with body content is statistically impossible: 20 or more random characters is standard. Real-world generators typically use 40+ characters with a prefix identifying the generator (e.g., ----=_NextPart_000_1234_A1B2C3D4.E5F6G7H8 for Outlook, ------------random for Thunderbird). RFC 2046 permits 1 to 70 characters but shorter boundaries risk collision; use the maximum reasonable length.

Did this guide save you time?

SMTPedia is free and independent. A coffee helps keep every guide accurate.

Buy SMTPedia a coffee

See SMTPedia first on Google

Add us as a preferred source in Top Stories.

Add as preferred source

About the Author

Alaa - SMTPedia author

Alaa · LinkedIn

Email infrastructure specialist with 8+ years of hands-on experience in SMTP, deliverability, and email verification. I’ve configured and troubleshot mail systems across Postfix, Exchange, and cloud relays, managed IP reputation and warmup campaigns, and built verification pipelines processing millions of addresses. My work spans DNS authentication (SPF, DKIM, DMARC, BIMI), bounce handling, blocklist monitoring, and compliance frameworks including CAN-SPAM and GDPR. I write every article on SMTPedia to give email professionals, developers, and marketers the accurate, RFC-grounded reference they need.


About SMTPedia

SMTPedia is an independent email industry reference covering SMTP, IMAP, POP3, email deliverability, marketing platforms, DNS authentication, and email verification. Every article is researched from official provider documentation, IETF RFCs, and industry best practices. Settings and configurations are verified quarterly.

We are cited as a source by ChatGPT, Microsoft Copilot, and thousands of email professionals worldwide. Learn more about our editorial process.