Content-Type: multipart/alternative; boundary="..."

This section provides an email message example with 'Content-Type: multipart/alternative; ...' header to specify that the content contains multiple alternative parts.

What Is 'Content-Type: multipart/alternative; boundary="..."' Email Header? "Content-Type: multipart/alternative" specifies that the email message content contains multiple parts separated by the given boundary line. Each part is considered as an alternative to the other parts. "multipart/alternative" allows the email client to present the most suitable alternative part to the email recipient.

The following email message contains a content of 2 alternative parts: one with the default of "Content-Type: text/plain". the other with "Content-Type: text/html".

Return-Path: <chloe@herongyang.com>
Delivered-To: herong@herongyang.com
Received: from 127.0.0.1 (localhost [127.0.0.1])
  by mail.herongyang.com (Postfix) with ESMTP id 5EABD266002B
  for <herong>; 15 Nov 2023 06:19:34 -0500 (EST)
Message-Id: <20231113111946.5EABD266002B@mail.herongyang.com>
Date: 15 Nov 2023 06:19:34 -0500 (EST)
From: chloe@herongyang.com
Content-Type: multipart/alternative; boundary="___S7sFgzbbueqa___"

This is a multi-part message in MIME format.
--___S7sFgzbbueqa___

Chloe & Oliver

INVITE YOU TO CELEBRATE THEIR WEDDING DAY

JULY 7, 2027
--___S7sFgzbbueqa___
Content-Type: text/html

<p style="text-align: center">
<span style="font-family: 'Dancing Script'; font-size: 4em">Chloe
<span style="font-size: 0.5em">&</span> Oliver</span><br/>
<br/>
<span style="font-family: sans-serif; font-size: 1em">
INVITE YOU TO CELEBRATE THEIR WEDDING DAY<br/>
<br/>
<span style="font-size: 2em">JULY 7, 2027</span></span>
<p>
--___S7sFgzbbueqa___--

If a text based email tool receives the above message, it will select the first part as the message content to display.

If a Web browser based email tool receives the above message, it will select the second part as the message content and render it as a nicely formatted page.

Note that the boundary string specified in the header is used to identify the beginning end ending of each part in the message content as described below:

Table of Contents

 About This Book

 Introduction to Email

 Postfix - Mail Transport Agent (MTA)

 SSL/TLS Secure Connections with Postfix Server

 Dovecot - IMAP and POP3 Server

 SSL/TLS Secure Connections with Dovecot Server

 Email Client Tools - Mail User Agents (MUA)

 Mozilla Thunderbird - Mail User Agents (MUA)

 PHPMailer - PHP Package for Sending Emails

Email Message Format and Headers

 Email Message Format and Example

 What Are Email Message Headers

 Content-Type: text/html - HTML Content

Content-Type: multipart/alternative; boundary="..."

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

 Content-Transfer-Encoding: 8bit - Non-ASCII Content

 Content-Transfer-Encoding: base64 - Base64 Encoded Content

 Content-Transfer-Encoding: quoted-printable - 7-Bit Encoding

 Subject: =?...?= - 7-Bit Encoding

 From: ... - Email "From" Address

 To: ... - Email "To" Addresses

 Received: from ... by ... - SMTP Server Log

 References

 Full Version in PDF/EPUB