Table of Contents

About

The last part of the email message is called the body or the content of the message.

It is what the user will see.

Format

An email has a content part with a mime type (format) that is set with the content-type email header.

Example:

Content-Type: text/plain; charset=us-ascii
Content-Type: multipart/alternative; boundary="b1_QOvc4qkAfaq7Tgiq7M6THogyrrifARe0NIlLwqdmT4"

If the content mime type is a multipart type:

  • the email body content is then composed of multiple part that have also a mime type
  • otherwise the content is composed only of one part

Multipart

Multipart. ie an email may be composed of several part where each part has another associated mime (format)

List:

  • multipart/alternative when sending HTML and TEXT
  • multipart/mixed when sending TEXT and attachments.

Alternative

The format of advanced designed email is created in special email html document but plain text is always added in the message as a fallback because:

  • not every email client support html
  • or not every user want to see fancy email page

The content of the various parts is interchangeable. The client will show the LAST part if possible.

A body is then composed of a content that has the mime type multipart/alternative where:

  • the HTML part is shown if possible
  • otherwise, the plain-text part is shown

See RFC2046 (Multipurpose Internet Mail Extensions (MIME) Part Two: Media Types) for details of the structure of such a message.

Example: complex multipart alternative with:

  • a text part
  • an html part with 2 subparts:
    • HTML markup
    • and inline image

The parts are delimited with a boundary and the base64 have been truncated but terminate with the classic ==

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

--b1_QOvc4qkAfaq7Tgiq7M6THogyrrifARe0NIlLwqdmT4
Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: base64

SGVsbG8sCgpUaGlzIGlzIE1hcmssIE1lZGlhIFB1Ymxpc2hlciBvZiBUZWNoVGltZXMuY29tLiBb
VGVjaHRpbWVzLmNvbV0oaHR0cHM6Ly93d3cudGVjaHRpbWVzLmNvbS8pIHdpdGggNSBtaWxsaW9u
.................
.................
IERpZ2l0YWwgTWVkaWFdKGh0dHBzOi8vd3d3LnRlY2h0aW1lcy5jb20vKQ==
--b1_QOvc4qkAfaq7Tgiq7M6THogyrrifARe0NIlLwqdmT4
Content-Type: multipart/related; boundary="b2_QOvc4qkAfaq7Tgiq7M6THogyrrifARe0NIlLwqdmT4"; type="text/html"

--b2_QOvc4qkAfaq7Tgiq7M6THogyrrifARe0NIlLwqdmT4
Content-Type: text/html; charset=utf-8
Content-Transfer-Encoding: base64

PGRpdiBzdHlsZT0iZm9udC1mYW1pbHk6IFZlcmRhbmEsIHNhbnMtc2VyaWY7IGZvbnQtc2l6ZTog
MTJweDsiPjxkaXY+PHNwYW4gc3R5bGU9ImZvbnQtZmFtaWx5OiBzeXN0ZW0tdWksIHNhbnMtc2Vy
aWY7IGZvbnQtc2l6ZTogMTRweDsgYmFja2dyb3VuZC1jb2xvcjogcmdiKDI1NSwgMjU1LCAyNTUp
.................
.................
bG9jay1lbXB0eSI+DQogICAgICAgIA0KICAgICAgICAgICAgPC9kaXY+DQo8L2Rpdj4NCg==
--b2_QOvc4qkAfaq7Tgiq7M6THogyrrifARe0NIlLwqdmT4
Content-Type: image/jpeg; name=image1697420268308
Content-Transfer-Encoding: base64
Content-ID: <[email protected]>
Content-Disposition: inline; filename=image1697420268308


--b2_QOvc4qkAfaq7Tgiq7M6THogyrrifARe0NIlLwqdmT4--
--b1_QOvc4qkAfaq7Tgiq7M6THogyrrifARe0NIlLwqdmT4--

Inline image

A part can be an inline image encoded in base64.

Example:

Content-Type: image/jpeg; name=image1697420268308
Content-Transfer-Encoding: base64
Content-ID: <[email protected]>
Content-Disposition: inline; filename=image1697420268308