SMTP

 

SMTP Bridge component allows you to connect to a remote e-mail server and send e-mails. SMTP is capable of handling:

SMTP Bridge uses SMTP protocol for transmission of e-mails. It uses the SMTP implementation from the JavaMail API.

Note: When sending attachments with the mail, if readFromFile attribute is set to yes, then the content of the tag is treated as the filename and if it is set to no, then content of the tag is treated as the content of the attachment with a dummy filename.

Configuration and Testing

Managed Connection Factory Panel

Figure 1: Managed Connection Factory

SMTP Server

Use Connection Details From Input

Parameters to create the connection can be specified in the input message when this property is set to true. If this property is selected the validation errors in the managed connection factory panel of the CPS are treated as warnings. So user can bypass this step without giving valid configuration and complete the configuration of the component. If valid properties are not provided even in the input message exception will be thrown at runtime.

MailServer IP/Name

The IP address or name of the SMTP mail server.

MailServer Port

The port on which the SMTP server is running on the host specified by the property MailServer IP/Name.

Use DefaultSession

The component uses a session (javax.mail.Session) to represent a mail session. A session collects together properties and defaults used by the mail APIs.

Additional Properties

Additional properties which can be used for creating connection can be specified here. For instance, to enable debug in Javamail set property 'mail.debug' to 'true'.

For example, to connect to gmail, we need to set the "MailServer IP/Name" and "MailServer Port" properties to "smtp.gmail.com" and "465" respectively. Apart from this we need to provide the following additional properties

mail.smtp.starttls.enable=true
mail.smtp.socketFactory.port=465
mail.smtp.socketFactory.class=javax.net.ssl.SSLSocketFactory
mail.smtp.socketFactory.fallback=false

Note : For the properties, which are supported by SMTP protocol please refer to http://java.sun.com/products/javamail/javadocs/com/sun/mail/smtp/package-summary.html

Authentication Details

Authentication required

Specifies whether the connection has to be authenticated by the SMTP Server. The properties Login Name and Password for authentication are relevant only if authentication is required.

Login Name

The Login Name with which the connection to SMTP Server is made. An user with login name specified must be valid with respect to the server whose URL is specified by property MailServer IP/Name.

Password for authentication

Password for the user as specified by the property Login Name.

TimeOut Settings

Connection Timeout for mail server

Socket connection timeout value in milliseconds. This is the time duration (in milliseconds) for which the component waits while trying to establish connection with the server. If the component fails to get a valid connection in the specified connection timeout interval, then the retry behavior depends on the configuration specified in Error Configuration Panel.  Default value -1 indicates infinite timeout.

Timeout for sending MIME message

Socket I/O timeout value in milliseconds while sending MIME message. If sending a MIME message requires more time, the current connection will be lost. For example, if attaching a file takes more than the specified timeout period then connection will be timed out by the component. Default value -1 indicates infinite timeout.

Interaction Configurations Panel

Figure 2: Interaction Configurations

Sender Information

Display Name of the Sender

Name of the Sender to be displayed in the mail that is sent using the component.

Note:

If the input message has <From> element, its value overrides the display name specified by this property.

Email ID of the Sender

The sender's e-mail ID. This ID must be valid with respect to the server details provided in the Managed Connection Factory Panel.

Note: If the input message has <From> element, its value overrides the e-mail ID specified by this property.

Input and Output

Input

SMTP component takes the input in XML format as shown in Figure 3.

Figure 3: Input in XML format

To: E-mail ID of the primary recipient(s). For multiple recipients, the e-mail IDs should be separated by comma.

From: E-mail ID of the sender. The E-mail ID provided here will override the value provided for property Email ID of the Sender  in the CPS. This element is optional.

CC: E-mail ID of the CC (carbon copy) recipient(s) to be copied in the e-mail. For multiple recipients, the e-mail IDs should be separated by comma. This element is optional.

BCC: E-mail ID of the BCC (blind carbon copy) recipient(s) to be copied in the mail. For multiple recipients, the e-mail IDs should be separated by comma. This element is optional.

ReplyTo: ReplyTo header field. Comma separated e-mail IDs can be used here.

The ReplyTo field is used by some e-mail programs when the Reply address is different than the From address.

While replying to an e-mail using Reply function, if ReplyTo header was set on the message, then the e-mail client shows the Reply-To field instead of the From field in the To address.  This element is optional.

Subject: Subject of the e-mail. This element is optional.

Headers: The headers provided (name value pairs) are added as Headers in the message.  This element is optional.

Note: This cannot be used to replace the default e-mail headers.

Attachments: This option is used to send attachments in the e-mail. This element is optional.

The attachment name is the value of the name attribute in the Attachment element.

Note:

Example: <Attachment name="attachment" readFromFile="no" base64Encoded="no">attachment content</Attachment>

Example: <Attachment name="attachment" readFromFile="yes" base64Encoded="no">/path/of/attachment</Attachment>

Body: Used to specify the e-mail message body. This element is optional.

When the property Use Connection details from input is chosen, an additional element ConnectionFactorySettings is added to the input schema, as shown in the figure. Properties that are used to create the connection are present under this element.

Figure 4: Input schema with ConnectionFactorySettings

Output

If the e-mail is sent successfully, then the component sends an XML output with a single element Result.

Figure 5: Sample response

Functional Demonstration

Scenario 1

Sending HTML mails with attachment (Note: choose scenario(s) that can be superset in terms of number of features it can demonstrate).

Configure the SMTP Bridge as described in Configuration and Testing section and use Feeder and Display component to send sample input and check the response respectively.

Figure 6: Demonstrating Scenario 1 with sample input and output

Figure 7: Mail sent by SMTP Bridge in the Inbox

Use Case Scenario

In an order entry scenario e-mails can be sent to concerned party when a PO is accepted or rejected.

Figure 8: Event Process demonstrating

The Event Process demonstrating this scenario is bundled with the installer.

Documentation of the scenario and instructions to run the flow can be found in the Help tab of flow when open in Fiorano Studio.

Useful Tips

SMTP component can be used as ESB Alerter when configured with ExceptionListener component to listen for exceptions from all flows.


Copyright © 2008-2010, Fiorano Software Pte. Ltd. and affiliates.

All rights reserved.

This software is the confidential and proprietary information of Fiorano Software ("Confidential Information"). You shall not disclose such Confidential Information and shall use it only in accordance with the terms of the license agreement enclosed with this product or entered into with Fiorano.