Create Headers for a Multipart
Every multipart must contain a Content-Type header. The header must have a boundary string, and the boundary string must match the boundary string in the multipart body of the message. Create a Content-Type header as shown below:
RWMimeMultipartType mixed;
RWMimeContentTypeHeader cTHead(mixed);
The default constructor for an
RWMimeMultipartType creates a
multipart/mixed type with a boundary string created by the
getUniqueBoundaryString() function of
RWMimeUtils. To create a value with a different subtype, provide the subtype to the constructor. For example, the line below creates a
multipart/alternative Content-Type value with an automatically-generated boundary parameter:
RWMimeMultipartType alternative("alternative");
MIME requires that a message contain a
MIME-Version header. Construct an
RWMimeVersionHeader.
RWMimeVersionHeader version;
The Content-Transfer-Encoding for a multipart message must be one of the identity encoded types – either 7bit, 8bit, or binary. To determine the Content-Transfer-Encoding:
If any of the parts to be included in the message has a
Content-Transfer-Encoding of
binary, use
binary.
Otherwise, if any of the parts to be included in the message has a
Content-Transfer-Encoding of
8bit, use
8bit.
Otherwise, use
7bit.
MIME parts often require protocol-specific headers in addition to MIME headers. For example, email messages require a Date header and a From header. The
RWMimeGenericHeader class represents a general-purpose header. If the part requires headers that aren’t part of the MIME format, use instances of
RWMimeGenericHeader for those headers. For example, the line below creates a From header for an email message:
RWMimeGenericHeader from("From:", "Dev <developer@roguewave.com>");