Mime multipart email example

Here is an example of a MIME multipart email:

Email Header

From: [email protected]
To: [email protected]
Subject: Example MIME Multipart Email

**Email Body**

This is a MIME multipart email. It contains multiple parts, each with its own content type.

**Part 1: Text/Plain**

Hello, this is the first part of the email. It is a plain text message.

**Part 2: Image/jpeg**

[Image data]

This is an image file in JPEG format.

**Part 3: Application/octet-stream**

[Binary data]

This is a binary file, such as a PDF document.

**Part 4: Text/HTML**

<html>
  <body>
    <p>This is the fourth part of the email. It is an HTML message.</p>
  </body>
</html>

**Email Footer**

MIME Header

MIME-Version: 1.0
Content-Type: multipart/mixed; boundary="===============1234567890=="

--===============1234567890==
Content-Type: text/plain

Hello, this is the first part of the email. It is a plain text message.

--===============1234567890==
Content-Type: image/jpeg

[Image data]

--===============1234567890==
Content-Type: application/octet-stream

[Binary data]

--===============1234567890==
Content-Type: text/html

<html>
  <body>
    <p>This is the fourth part of the email. It is an HTML message.</p>
  </body>
</html>

--===============1234567890==--

In this example, the email has four parts:

  1. A plain text message (text/plain)
  2. An image file in JPEG format (image/jpeg)
  3. A binary file (application/octet-stream)
  4. An HTML message (text/html)

The email is formatted using the MIME multipart/mixed type, which allows multiple parts to be included in a single email. Each part is separated by a boundary string (===============1234567890==), and each part has its own Content-Type header that specifies the type of content it contains.

When the email is received, the recipient's email client will parse the MIME headers and display the email accordingly. For example, the email client may display the plain text message, show the image file as an attachment, and render the HTML message as a web page.