The MIME Package Representation of a Message
This section describes the structure of the MIME package representation of a message.
Figure 15 shows an informal diagram of a multipart message that contains single part MIME parts. Note that this diagram contains only the most important information. In particular, the diagram does not illustrate the details of the
RWMimeHeader class.
The message itself is represented as an instance of
RWMimeMultipart. A multipart holds three things: a collection of
RWMimeHeader objects, a collection of
RWMimePart objects, and an
RWCString preamble. The part body collection and the header collection may be empty. The preamble is always present, but may be an empty string.
Each
RWMimePart itself contains a collection of headers and a part body. For a simple MIME part, the part body is an
RWCString.
The MIME message in
Example 27 contains two MIME parts. The first part is text intended for display in an email reader. The second is an attached text file.
Example 27 – MIME multipart message
MIME-Version: 1.0
Content-Type: multipart/mixed; boundary="_=_next_part_785819629_=_"
From: Rudi Marquez <rudi_marquez@roguewave.com>
To: Andy Roture <roture@example.org>
Date: Tue, 30 Oct 2001 08:20:23 -0700 (PST)
Subject: A Multipart MIME Message
If you are reading this text, your mailer does not
understand MIME multipart attachments.
--_=_next_part_785819629_=_
Content-Type: text/plain; charset=US-ASCII
This text forms the body of the email message in
a MIME-compliant email viewer.
--_=_next_part_785819629_=_
Content-Type: text/plain
Content-Disposition: attachment; filename="moretext.txt"
Content-Transfer-Encoding: 7bit
This is a text file contained within the multipart MIME message.
--_=_next_part_785819629_=_--
As shown in
Figure 15 , the MIME package represents this message as an instance of
RWMimeMultipart. The instance holds an
RWMimeHeader object for each header in the message – in this case, 6 objects. The preamble of the multipart, an
RWCString, contains this text:
If you are reading this text, your mailer does not
understand MIME multipart attachments.
The message holds two
RWMimePart objects. The first part contains a single header and the
RWCString part body
This text forms the body of the email message in
a MIME-compliant email viewer.
The other part contains 3 headers and the
RWCString part body
This is a text file contained within a multipart MIME message.
Notice that every simple MIME part within the message is represented using
RWMimePart. The MIME package itself does not distinguish between the content of the message and the attached file.