The MessagePart property returns the contents of the
specified message part. All messages have at least one part, which
consists of one or more header fields, followed by the body of the
message. The default part, part 1, refers to the main message header
and body. If the message contains multiple parts (as with a message
that contains one or more attached files), the MessagePart
property can be set to refer to that specific part of the
message.
Messages with file attachments typically consist of a message part
which describes the contents of the attachment, followed by the
attachment itself. For a message with one attached file, there would
be a total of three parts. Part 1 would refer to the main message
part, which contains the headers such as From, To, Subject, Date and
so on. For multipart messages, part 1 typically does not have a
message body, since any text is usually created as a separate part
(for those messages that do not contain multiple parts, the part 1
body contains the text message). Part 2 would contain the text
describing the attachment, and part 3 would contain the attachment
itself. If the attached file is binary, then the transfer encoding
type would usually be base64.
It is important to note that an IMAP server considers the first
part of a multipart message to be part 1, so the MessagePart
property array is one-based. This is different than the SocketTools
MIME control, which considers the first part of a multipart message
to be zero.