Mail Mime Service
The Mail Mime service constructs a MIME message or parses a MIME message to extract content for further processing.
The following table provides an overview of the Mail Mime service:
Category | Description |
---|---|
System name | MailMimeService |
Graphical Process Modeler (GPM) categories | All Services, Communications |
Description | The Mail Mime service is used to construct a MIME message or to parse a MIME message. To construct a MIME message for outgoing e-mail, the service picks up the input data from the primary document. This becomes the body of the e-mail. Attachment data may be read from the file system, the document area, or both. All data is merged together into a single multipart MIME message. The resulting MIME message is placed in the primary document. The MIME message is then typically sent to the SMTP adapter to mail it. When parsing incoming e-mail, this service is typically preceded by the B2B Mail Client adapter, which actually receives the message, and passes it along to this service using the primary document. This service picks up the MIME message, including attachments, from the primary document. The primary message (body) is extracted and replaces the primary document. The rest of the messages (attachments) are placed in the document area. Each incoming attachment is referenced by a unique key. This key has the format “Mail_Mime_DOC_n”, where “n” is the message count starting from 2 onwards. Message 1 is assumed to be the primary message. The service extracts the attachment MIME type and other attachment header information for use by other services. |
Business usage | This service can be used to construct a MIME message, or to parse a MIME message and extract the message content for further processing. |
Usage example | Your company receives MIME messages from another business. You could use the Mail Mime service to parse these messages as part of a business process. |
Preconfigured? | No |
Requires third-party files? | No |
Platform availability | All supported Sterling B2B Integrator platforms |
Related services | Related services:
|
Application requirements | None |
Initiates business processes? | No |
Invocation | Invoked by an internal service |
Business process context considerations | None |
Returned status values | Returned status values:
|
Restrictions | Due to the use of a fully-qualified path name, this service is restricted to picking up files it can access directly and on specifically named systems. This service does not support document streaming for files > 900 MB. |
Persistence level | System default |
Testing considerations | You can use the business process examples later
in this section to test a configuration of the service. The problems
encountered most frequently are:
|
How the Mail Mime Service Works
The Mail Mime service is used for building or parsing a MIME message.
- The Mail Mime service picks up the input data from the primary document or from the file system or a combination of both.
- The newly-built MIME message is returned as the primary document.
- The Mail Mime service picks up the MIME message from the primary document and extracts the message contents to the primary document and to the document area of process data.
- The content of the first message is returned as the primary document and the content of the subsequent messages is output to the document area of process data. These messages are each referenced by a unique key with the format Mail_Mime_DOC_n, where n is the message count, starting with the number 2.
Implementing the Mail Mime Service
- Create a Mail Mime service configuration. For information, see Managing Services and Adapters.
- Configure the Mail Mime service. For information, see Configuring the Mail Mime Service.
- Use the Mail Mime service in a business process.
Configuring the Mail Mime Service
- The parameter mail-mime-attachment(n) must include a fully qualified path to the file.
- The file system provides all header and MIME information needed when using files as attachments. No configuration of attachment information (other than filename) is required within Sterling B2B Integrator.
- The fields in the following tables apply to building MIME messages, except mail-mime operation, which applies to parsing MIME messages. When the operation is parse, all values are read from the incoming message.
Sterling B2B Integrator Configuration
The following table describes the fields used to configure the Mail Mime service in Sterling B2B Integrator:
Field | Description |
---|---|
Name | Unique and meaningful name for the service configuration. Required. |
Description | Meaningful description for the service configuration, for reference purposes. Required. |
Select a Group | Select one of the options:
|
Select the operation type(mail-mime-operation) | Specifies whether to build or parse a message.
Optional. Valid values are:
Note: If you are
writing a business process without using the GPM, use the term “build”
instead of “construct”.
|
GPM Configuration
The following table describes the fields that are used to configure the Mail Mime service in the GPM:
Field | Description |
---|---|
Config | Name of the service configuration. |
mail-mime-bcc | The bcc field of the MIME message. Valid value is valid E-mail address. Optional for build. |
mail-mime-body | Whether to get input data from the primary document. Valid values are True and False. Default is True. Optional for build. |
mail-mime-cc | The cc field of the MIME message. Valid value is valid E-mail address. Optional for build. |
mail-mime-recipient | Recipient of the MIME message. Valid value is valid E-mail address. Optional for build. |
mail-mime-sender | Originator of the MIME message. Valid value is valid E-mail address. Optional for build. |
mail-mime-subject | Subject field of the MIME message. Optional for build. |
mail-mime-subject-encoding | Encoding type of the subject. Valid value is valid encoding type. Optional for build. |
mail-mime-use-doc-area | Include documents in the document area of process data as attachments. All documents will be collected. Valid values are true and false. Default is false. Optional for build. |
Parse | Not used. Leave at default. |
Note: All of the previous parameters
(with the exception of mail-mime-operation) apply to building MIME
messages. If the operation type is parse, all values will be read
from the incoming message.
|
|
Note: The following parameters are not
displayed in the GPM by default, however, you can manually add these
parameters when necessary.
|
|
mail-mime-attachment-count | Total number of attachments to be picked up from the file system. Optional. |
mail-mime-attachment(n) | To specify each attachment, where n is the attachment count such as 1, 2, 3....n. Valid value is a fully-qualified path to a file on the file system. Optional. |
Parameters Passed from Business Process to Service
The following parameters can be passed to the service when started from a business process:
Parameter | Description |
---|---|
mail-mime-attachment-count | Total number of attachments to be picked up from the file system. Optional. |
mail-mime-use-doc-area | Include documents in the document area of process data as attachments. All documents will be collected. Valid values are True and False. Default is False. Optional for build. |
mail-mime-attachment(n) | To specify each attachment, where n is the attachment count. Valid value is a fully-qualified path to a file on the file system. Optional. |
mail-mime-set-attachment | To specify if the contents of the primary document are set as an attachment in the MIME message. Valid values are True and False, and mail-mime-body must = True. |
mail-mime-body | Whether to get input data from the primary document. Valid values are True and False. Default is True. Optional for build. |
mail-mime-sender | Originator of the MIME message. Valid value is valid E-mail address. Optional. |
mail-mime-recipient | Recipient of the MIME message. Valid value is valid E-mail address. Optional. |
mail-mime-cc | The cc field of the MIME message. Valid value is valid E-mail address. Optional. |
mail-mime-bcc | The bcc field of the MIME message. Valid value is valid E-mail address. Optional. |
mail-mime-subject | Subject field of the MIME message. Optional. |
mail-mime-subject-encoding | Encoding type of the subject. Valid value is valid encoding type. Optional. |
How the Mail Mime Service Handles Attachment Data
For the build operation, the Mail Mime service can retrieve attachment data from the file system or the business process context. If the attachment data is in the file system, the service automatically looks up the content type and subtype of the data from the file system repository. If the attachment data is in the business process context, the filename and the content type/subtype information is read from the business process document. It is the responsibility of the calling business process to pass this information to the service. You can use the Get Document Info service to set or get the information.
The parse operation reads all information from the incoming e-mail and its attachments. Each attachment has data available for its name, MIME type and subtype, and character encoding. This information is made available when the attachments are written to the document area of process data.
Process Data Examples
When the Mail Mime service parses a MIME message, the total count of messages (including attachments) is output to the process data, in the format shown in the following example:
<ProcessData>
<Mail_Mime>
<Total_Message_Content>
{---value----}
</Total_Message_Content>
</Mail_Mime>
</ProcessData>
The following example of process data is created when the Mail Mime service parses a MIME message with four message parts (main body and three attachments):
<ProcessData>
<PrimaryDocument SCIObjectID="prodsys3:123c99:f88fee0b27:-796e"/>
<Mail_Mime_DOC_2 SCIObjectID=" prodsys3:123c99:f88fee0b27:-796c"/>
<Mail_Mime_DOC_3 SCIObjectID=" prodsys3:123c99:f88fee0b27:-796a"/>
<Mail_Mime_DOC_4 SCIObjectID=" prodsys3:123c99:f88fee0b27:-7968"/>
<Mail_Mime>
<Total_Message_Content>4</Total_Message_Content>
</Mail_Mime>
</ProcessData>
The first message content is put into the primary document and the attachments are placed in the document area, which can be referenced by a unique index key. The format of the unique index key is Mail_Mime_DOC_n, where n is the message count. The sample above shows that a total of four message parts is extracted from the MIME message. The first part is put in the primary document. The attachments are put into the document area, and they can each be referenced by a unique index key such as Mail_Mime_DOC_2, Mail_Mime_DOC_3 and Mail_Mime_DOC_4 respectively.
Business Process Examples
This section contains sample business processes that illustrate by using the Mail Mime service to build or parse messages.
Building a Mime Message
The following business process illustrates building a MIME message from the primary document and sending the MIME message to an SMTP server, 00.000.00.00.
<process name="Test_mm_build">
<sequence name="optional">
<operation name="Build a mime message">
<participant name="MailMimeService"/>
<output message="Xout">
<assign to="." from="*"></assign>
<assign to="mail-mime-operation">build</assign>
<assign to="mail-mime-body">true</assign>
<assign to="mail-mime-sender">ediintout@joeuser.mycompany.com</assign>
<assign to="mail-mime-recipient">steveuser@mycompany.com</assign>
<assign to="mail-mime-subject">This is my subject</assign>
</output>
<input message="Xin">
<assign to="." from="*"></assign>
</input>
</operation>
<operation name="One">
<participant name="SMTP_SEND_ADAPTER"/>
<output message="Xout">
<assign to="." from="*"></assign>
<assign to="xport-smtp-mailhost">00.000.00.00</assign>
<assign to="xport-smtp-mailport">25</assign>
<assign to="b2b-raw-message">true</assign>
</output>
<input message="Xin">
<assign to="." from="*"></assign>
</input>
</operation>
</sequence>
</process>
The following business process illustrates building a MIME message with 12 attachments. Each attachment is picked up from the file system:
<process name="Test_mm_build">
<sequence name="optional">
<operation name="One">
<participant name="MailMimeService"/>
<output message="Xout">
<assign to="." from="*"></assign>
<assign to="mail-mime-operation">build</assign>
<assign to="mail-mime-body">false</assign>
<assign to="mail-mime-attachment-count">12</assign>
<assign to="mail-mime-attachment1">/home/testsys/test_data/smc1.props
</assign>
<assign to="mail-mime-attachment2">/home/testsys/test_data/smc2.props
</assign>
<assign to="mail-mime-attachment3">/home/testsys/test_data/smc3.props
</assign>
<assign to="mail-mime-attachment4">/home/testsys/test_data/smc4.props
</assign>
<assign to="mail-mime-attachment5">/home/testsys/test_data/smc5.props
</assign>
<assign to="mail-mime-attachment6">/home/testsys/test_data/smc6.props
</assign>
<assign to="mail-mime-attachment7">/home/testsys/test_data/smc7.props
</assign>
<assign to="mail-mime-attachment8">/home/testsys/test_data/smc8.props
</assign>
<assign to="mail-mime-attachment9">/home/testsys/test_data/smc9.props
</assign>
<assign to="mail-mime-attachment10">/home/testsys/test_data/smc10.props
</assign>
<assign to="mail-mime-attachment11">/home/testsys/test_data/smc11.props
</assign>
<assign to="mail-mime-attachment12">/home/testsys/test_data/smc12.props
</assign>
<assign to="mail-mime-sender">ediintout@companyname.com</assign>
<assign to="mail-mime-recipient">ediintin@companyname.com</assign>
<assign to="mail-mime-subject">This is a mime message with 12 attachments
</assign>
</output>
<input message="Xin">
<assign to="." from="*"></assign>
</input>
</operation>
</sequence>
</process>
Parsing a Mime Message
The following business process example illustrates parsing a MIME message. The Mail Mime service picks up the MIME message from the primary document, extracts all the message contents, and outputs them to the primary document and the document area:
<process name="Test_mm_parse">
<sequence name="optional">
<operation name="One">
<participant name="MailMimeService"/>
<output message="Xout">
<assign to="." from="*"></assign>
<assign to="mail-mime-operation">parse</assign>
</output>
<input message="Xin">
<assign to="." from="*"></assign>
</input>
</operation>
</sequence>
</process>