Email MIME Structure Explained: multipart/mixed, multipart/alternative, and How Email Is Really Built

By MDToolsOne β€’
Email MIME multipart structure and attachments Breaking down MIME parts, attachments, and multipart email structure

Modern emails are far more than plain text messages. They include HTML, inline images, attachments, multiple languages, and rich formatting β€” all transported through protocols originally designed for simple ASCII text.

The system that makes this possible is MIME (Multipurpose Internet Mail Extensions).

This article explains how MIME works, what multipart/mixed and multipart/alternative mean, and how real emails are structured under the hood. If you're new to the transport layer, see how email servers work.

What Is MIME?

MIME is a standard that extends email to support:

  • Attachments
  • HTML content
  • Inline images
  • Multiple encodings
  • Non-ASCII characters

MIME works entirely through email headers and body structure, without changing SMTP itself. For header-level analysis, see email headers deep dive.

Content-Type and Content-Transfer-Encoding

Every MIME part includes at least two critical headers:

  • Content-Type β€” what the data is
  • Content-Transfer-Encoding β€” how it’s encoded
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable

These headers tell email clients exactly how to interpret each section. Learn more about encodings like Quoted-Printable and Base64 encoding.

multipart/* β€” Emails with Multiple Parts

When an email contains more than one piece of content, it uses a multipart MIME type.

Content-Type: multipart/mixed; boundary="abc123"

The boundary defines where each part starts and ends.

multipart/mixed: Attachments and Content

multipart/mixed is the most common multipart type. It is used when an email contains attachments.

Typical structure:

  • Main message body
  • One or more attachments
--abc123
Content-Type: text/plain

Hello
--abc123
Content-Type: application/pdf
Content-Disposition: attachment; filename="file.pdf"
--abc123--

Email clients display the first part as the message and treat the remaining parts as attachments.

multipart/alternative: Text and HTML Versions

multipart/alternative is used when the same content is provided in multiple formats.

  • Plain text version
  • HTML version
Content-Type: multipart/alternative

Email clients choose the best version they support β€” typically HTML. Charset handling is also critical here β€” see UTF-8 vs ASCII vs Unicode in email.

Nested Multipart Structures

Real-world emails often combine multiple MIME types:

  • multipart/mixed (outer)
  • multipart/alternative (inner)
  • Attachments encoded with Base64

This nesting allows:

  • HTML + text content
  • Inline images
  • Multiple attachments

MIME and Encodings

MIME defines how content is structured β€” encoding defines how bytes are represented.

Encoding Used For
Quoted-Printable Text and HTML
Base64 Attachments
7bit / 8bit Simple ASCII

Incorrect encoding choices can break rendering and even trigger spam filters.

MIME in EML and MBOX Files

EML and MBOX formats store MIME messages exactly as transmitted.

Understanding MIME is essential for:

  • Email parsing tools
  • Security analysis
  • Forensic investigations
  • Email migration and archiving

Learn more about storage formats in EML files explained and MBOX files explained.

Common MIME Problems

  • Incorrect boundary definitions
  • Wrong content type
  • Broken encoding declarations
  • Inline images treated as attachments
  • HTML displayed as plain text

Many of these issues surface during SMTP troubleshooting or deliverability debugging.

Final Thoughts

MIME is the hidden framework behind every modern email. Without it, attachments, HTML, and international content would not exist.

Understanding MIME structure transforms email from a fragile black box into a predictable, debuggable system. Combined with knowledge of email metrics and deliverability signals, it becomes a powerful diagnostic skill.

Frequently Asked Questions

What is MIME in email?

MIME (Multipurpose Internet Mail Extensions) defines standards for email content types, encoding text, attachments, and multiple parts in a single message.

What is a multipart email?

Multipart email uses boundaries to separate text, HTML, and attachments, allowing mixed content in one message.

Why is MIME important for modern email?

MIME enables rich content, embedded images, attachments, and proper encoding, making email universally supported across clients.

MDToolsOne