Software AG Products 10.7 | Integrating On-Premises and Cloud Applications | Managing MIME messages | Overview of MIME and S/MIME Messages | What Is MIME? | Basic Structure of a MIME Message | Multipart MIME Messages
 
Multipart MIME Messages
One of the key reasons for the development of MIME was to allow the transmission of multiple files (payloads) in a single message. When a MIME message contains multiple payloads, it has two kinds of header fields: message headers, which appear only at the beginning of the message, and part headers, which appear at the beginning of each body part.
Message headers apply to the entire message. Part headers apply only to the body part in which they appear. The following example shows a MIME message with two body parts.
A multipart MIME message
If a MIME message has more than one payload, its Content-Type header field must be set to a multipart content type (for example, Content-Type:multipart/mixed or Content-Type:multipart/alternative), and it must declare a boundary separator. The boundary separator is a string that delimits body parts. It must appear before and after each part in the message. (In the example above, the string X----B164240404-----X is the boundary separator.)
Note:
You may have noticed that the string separating the body parts in the preceding example includes a few extra characters that are not part of the separator string declared in the Content-Type header field. This is because the MIME format requires that two dash characters precede each separator in the message and two dash characters follow the last separator string in the message.
When you build a multipart message with webMethods Integration Server, it automatically sets the Content-Type header to “multipart,” declares the separator string, and inserts the boundary separators for you.