RFC 2045: MIME Part One: Format of Internet Message Bodies

Defines the MIME content-type header and the framework for non-ASCII message bodies.
Alaa
By Alaa
SMTPedia documents email infrastructure end to end: SMTP standards from the RFC archive, delivera...
8 min read Updated Jul 22, 2026 135 views
RFC 2045
MIME Part One: Format of Internet Message Bodies
Current standard
Domain
MIME
Published
November 1996
Supersedes
First in series
SMTP relevance
foundational
↗ Read on rfc-editor.org

What this RFC defines

RFC 2045 is the first of the five MIME RFCs. It defines the MIME-Version header, the Content-Type header, and the Content-Transfer-Encoding header. It establishes the framework that all subsequent MIME RFCs build on: the idea that a message body can be anything, and headers describe what it is and how it is encoded.

Where you see it in practice

The MIME-Version: 1.0 header present in every MIME email comes from this RFC. The Content-Transfer-Encoding: base64 you see on email attachments is defined in section 6.8. When a spam filter or email client cannot parse a Content-Type header correctly, the root specification it is checking against is RFC 2045.

How it connects to other RFCs

RFC 2045 is the base of the MIME suite. RFC 2046 defines the media type system, RFC 2047 handles non-ASCII headers, RFC 2048 defined registration procedures (since replaced by RFC 4288), and RFC 2049 provides conformance criteria. RFC 5322 defines the message envelope that MIME rides inside.

Current status

RFC 2045 is a current standard, published November 1996. It has not been superseded and remains the authoritative reference for MIME message structure.

The MIME-Version header

RFC 2045 introduced the MIME-Version header field, which every modern email carries as MIME-Version: 1.0. The header signals that the message follows MIME encoding rules and that Content-Type, Content-Transfer-Encoding, and related headers should be interpreted per RFC 2045-2049. Messages without this header are pre-MIME and are treated as plain text under the RFC 822 rules. Every email client, from Outlook to Gmail to command-line mail utilities, inserts MIME-Version: 1.0 by default; a message missing this header will still be delivered but rendered as if it were 1982-era mail.

Content-Transfer-Encoding options

RFC 2045 defines five transfer encodings: 7bit (pure ASCII), 8bit (8-bit bytes, requires 8BITMIME), binary (arbitrary bytes, rarely used in mail), quoted-printable (7-bit-safe encoding of mostly-ASCII text with occasional non-ASCII), and base64 (7-bit-safe encoding of binary data). The choice of encoding affects both message size and transport compatibility. Quoted-printable adds about 3% overhead for mostly-ASCII text; Base64 adds about 33% for any content. Modern MTAs handle all five, but legacy gateways and archived mail sometimes fail on 8bit or binary encodings.

Why MIME parsing is famously difficult

MIME parsing is a leading source of bugs in email libraries because the grammar is layered: RFC 2045 defines the header fields, RFC 2046 defines multipart structure, and RFC 2047 defines encoded-word syntax for non-ASCII header values. A robust parser must handle all three simultaneously, plus edge cases like nested multiparts, mismatched boundaries, missing Content-Type declarations (defaulting to text/plain per RFC 2046), and adversarial input designed to confuse security scanners. Every widely-used email library has been patched multiple times for MIME parsing vulnerabilities.

Quick Reference

RFC 2045 (November 1996) is the base of the MIME (Multipurpose Internet Mail Extensions) family: five documents (RFC 2045 through 2049) that let email carry structured content beyond ASCII text. RFC 2045 specifically defines the Content-Type, Content-Transfer-Encoding, and MIME-Version headers. Companions: RFC 2046 defines media types (text, image, audio, multipart), RFC 2047 encoded-word for non-ASCII in headers, RFC 2048 registration procedures, RFC 2049 conformance criteria. Foundation for every email attachment, HTML message, and structured content.

RFC 2045 at a glance

AspectDetail
PurposeDefine headers that describe non-ASCII, non-text, structured email content
Key headersMIME-Version, Content-Type, Content-Transfer-Encoding
Companion RFCsRFC 2046 media types, RFC 2047 encoded-word, RFC 2048 registration, RFC 2049 conformance
Encodings7bit (ASCII), 8bit, binary, quoted-printable, base64
EnablesAttachments, HTML mail, multipart structure, character sets, video/audio inline
PublishedNovember 1996
StatusFoundational standard; no successor planned

The three core MIME headers

HeaderPurposeExample
MIME-VersionDeclare message uses MIME (always 1.0)MIME-Version: 1.0
Content-TypeMedia type of the content (or part)Content-Type: text/html; charset=utf-8
Content-Transfer-EncodingHow the content is encoded for transportContent-Transfer-Encoding: base64

Content-Transfer-Encoding values

EncodingPurposeOverheadTypical use
7bitContent is already ASCII, no encoding neededNonePlain text ASCII messages
8bitContent contains 8-bit bytes, no encoding appliedNoneUTF-8 bodies on 8BITMIME-capable paths
binaryAny byte value including nulls; no line semanticsNoneBINARYMIME transport only (RFC 3030)
quoted-printableEscape non-ASCII as =XX hex~20-100% for non-ASCII heavy contentMostly-ASCII text with occasional non-ASCII
base64Encode as ASCII alphabet 64 chars~33%Binary attachments, images, video

Content-Type syntax and parameters

Content-Type structure with parameters Content-Type: type/subtype; parameter=value; parameter=valueStructure: type Major category (text, image, audio, video, application, multipart, message) subtype Specific format within type (plain, html, jpeg, mp4, pdf, mixed, rfc822) parameters Semicolon-separated key=value; whitespace/quoting per RFC 5322 rulesCommon examples: Content-Type: text/plain; charset=utf-8 Content-Type: text/html; charset=utf-8 Content-Type: image/jpeg Content-Type: application/pdf; name=”report.pdf” Content-Type: multipart/mixed; boundary=”boundary-abc” Content-Type: multipart/alternative; boundary=”alt-boundary-xyz”Parameters common across many types: charset Character set for text types (utf-8 recommended) boundary Delimiter for multipart types name Suggested filename for attachments format Text formatting (flowed per RFC 3676 for reflowable text)

Multipart structure (defined in RFC 2046)

Typical email with HTML, plain text, and attachment Content-Type: multipart/mixed; boundary=”mixed-boundary”–mixed-boundary Content-Type: multipart/alternative; boundary=”alt-boundary”–alt-boundary Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bitHello, this is the plain text version.–alt-boundary Content-Type: text/html; charset=utf-8 Content-Transfer-Encoding: quoted-printable<p>Hello, this is the =E2=80=9CHTML=E2=80=9D version.</p>–alt-boundary––mixed-boundary Content-Type: application/pdf; name=”invoice.pdf” Content-Transfer-Encoding: base64 Content-Disposition: attachment; filename=”invoice.pdf”JVBERi0xLjQKJeLjz9MKMSAwIG9iago8PC9UeXBl… [base64 continues for the PDF content]–mixed-boundary–

Common MIME implementation mistakes

Boundary collision with body content. The boundary parameter must not appear anywhere in the body content. If a message body accidentally contains the boundary string, parsers split at the wrong location and produce corrupted output. Generators should use long random boundaries (e.g., boundary="----=_NextPart_A1B2C3D4E5F6") to make accidental collision statistically impossible.
Not escaping filename parameters correctly. Content-Type name and Content-Disposition filename parameters can contain non-ASCII or special characters. RFC 2231 defines the proper escaping (percent-encoding with charset prefix). Naive quoting fails on Unicode filenames; use a library that implements RFC 2231.
Incorrect Content-Transfer-Encoding declaration. Declaring base64 for a body that is actually 8bit, or vice versa, causes parsers to decode incorrectly. Symptoms: garbled text, broken images. Fix: match the declared encoding to the actual encoding applied. Most modern libraries handle this automatically; hand-rolled MIME emission code is the frequent culprit.
Zip-bomb and depth attacks on multipart parsing. Adversarial multipart messages can have millions of nested parts, oversize boundaries, or exponentially expanding content. Naive parsers exhaust memory or CPU. Modern parsers should enforce limits: maximum multipart depth (~10), maximum part count (~1000), maximum content size per part, and total message size.
Trusting the declared Content-Type of attachments. The Content-Type in the message is what the sender claims; the actual content may differ. Antivirus and content scanners should content-sniff to verify, not rely on the declared type. This is particularly important for HTML mail where declared text/html can hide script content or embedded scripts.
MIME family RFCs
  • RFC 2046: Media types and multipart structure
  • RFC 2047: Encoded-word syntax for non-ASCII in headers
  • RFC 2048: Registration procedures for media types
  • RFC 2049: Conformance criteria and examples
  • RFC 2231: MIME parameter value extensions (RFC 2231 escaping)
  • RFC 3676: text/plain format=flowed (reflowable text)
  • RFC 4021: Registration of mail header fields (includes MIME headers)
SMTP transport for MIME content
  • RFC 5321: SMTP base protocol
  • RFC 5322: Internet Message Format
  • RFC 6152: 8BITMIME (transport for 8-bit encoded MIME bodies)
  • RFC 6531: SMTPUTF8 (transport for UTF-8 in envelope)
SMTPedia companion guides

Frequently asked questions

Why is MIME-Version always 1.0?

Historical accident. When MIME was designed, the version was expected to increment as capabilities evolved. In practice, MIME extensions (RFC 2231 parameter escaping, new media types, format=flowed, S/MIME) were added without version bumping; the ecosystem preferred backward compatibility to versioning. Modern messages MUST include MIME-Version: 1.0 per RFC 2045 to signal MIME awareness; higher values do not exist in practice.

When should I use quoted-printable vs base64?

quoted-printable for mostly-ASCII text with occasional non-ASCII: preserves human readability, moderate overhead. base64 for binary content or heavily non-ASCII text: fixed ~33% overhead, universal compatibility. Rule of thumb: text/plain or text/html with UTF-8 → quoted-printable; images, PDFs, video → base64. Most modern libraries choose automatically based on content analysis.

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

multipart/mixed: parts are conceptually different content (message body + attachment + another attachment). Recipients see all parts. multipart/alternative: parts are different representations of the same content (plain text version + HTML version of the same message). Recipients see the best-supported version, not both. HTML emails typically use multipart/mixed[multipart/alternative[text/plain, text/html], application/pdf]: alternative pair for body, mixed wrapper to include attachments.

Can MIME content contain arbitrary binary data?

Yes, via base64 encoding over any transport, or via 8bit/binary encoding over transport that supports it (8BITMIME for 8-bit, BINARYMIME per RFC 3030 for binary). base64 is universally compatible; 8bit and binary require negotiation. For attachments (images, PDFs, video, executables), base64 is the standard choice because it works across all mail paths.

Why are MIME parsers a common source of security vulnerabilities?

MIME parsing is remarkably complex: recursive multipart nesting, encoded-word decoding in various contexts, parameter escaping per RFC 2231, header folding, canonicalization for signing. Adversarial input designed to confuse the parser (deeply nested multiparts, oversize boundaries, malformed encoded-word, boundary collisions with body content) has produced remote code execution vulnerabilities in every major email library at some point. Modern practice: use well-maintained libraries, enforce depth and size limits, sandbox content extraction, and treat MIME as untrusted input requiring defensive parsing.


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.