One or more attachments can be included in an e-mail using the MIME Adapter. Each attachment is defined as a single MIME part, which is the basic building block of the MIME format (MIME stands for Multipurpose Internet Mail Extensions).
Even the most complicated MIME message boils down to a collection of MIME parts, which can be arranged in a hierarchical structure. The MIME specification refers to messages that contain multiple documents as multipart parts. Once the multipart parts have been created, the SMTP header parameter like MIME version and content type are added before sending the e-mail. The content type is multipart/mixed, a multipart type typically used for e-mail attachments.

For more information on the MIME part structure, refer to the documenation of the MIME Adapter.

Example File (Builder project Add-ons/EMail):

<your example path>\Add-ons\EMail\uml\smtpEmailing.xml

Example

The activity diagram below shows, how attachments are passed to the SMTP server as MIME part input objects of different base types, e.g. String and Blob.

Figure: Sending E-mails with Attachments Activity Diagram

  1. Action create an image mime part transforms the attachments into objects of type MIMEPart. If the MIME parts are passed in SOAP requests, they are embedded in the SOAP message body as blobs. When creating the MIMEPart objects, you have to make sure to transform the content to a blob if necessary.
  2. The MIME parts are stored in the multiparts array.
  3. The action state create MIME message has the stereotype <<MIMEConverter>> assigned. Its purpose is to assemble the final e-mail content from the multipart array. SMTP header parameters like the MIME version and the content type multipart/mixed will be added to the array headerParameters. Along with other input parameters, they will be passed to the SMTP adapter that sends the e-mail.
  4. By setting the contentName, the text will be attached in a file with the given name – as shown for object textAttachement. For object textPart no name is given, the text will appear in the mail-body.
On this Page:
Related Pages: