Nested Body Parts
Multipart messages are themselves nested. Nesting body parts is similar. This type of nesting can be very useful if you want to forward an email message, for example, that has attachments itself.
Look carefully at the Content-Type headers in the following example. There are six of them! The one on the message header is a composite type (multipart/mixed), allowing it to have message parts under it. One of the parts is a simple text message, and the other is a complete mail message.
The encapsulated mail message itself has an outer wrapper, a message-level Content-Type header that is declared as type message/rfc822, another composite type. In turn, it holds a text message and an image from a previous example.
From: Al Gore <vice-president@whitehouse.gov> To: White House Transportation Coordinator <transport@whitehouse.gov> Subject: [Fwd: Map of Argentina with Description] Content-Type: multipart/mixed; boundary="D7F------------D7FD5A0B8AB9C65CCDBFA872" This is a multi-part message in MIME format. --D7F------------D7FD5A0B8AB9C65CCDBFA872 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Fred, Fire up Air Force One! We're going South! Thanks, Al --D7F------------D7FD5A0B8AB9C65CCDBFA872 Content-Type: message/rfc822 Content-Transfer-Encoding: 7bit Content-Disposition: inline Return-Path: <president@whitehouse.gov> Received: from mailhost.whitehouse.gov ([192.168.51.200]) by heartbeat.whitehouse.gov (8.8.8/8.8.8) with ESMTP id SAA22453 for <vice-president@heartbeat.whitehouse.gov>; ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access