Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

The MailTo transport supports sending messages (E-Mail) over SMTP and receiving messages over POP3 or IMAP. This transport implementation is available as a module of the WS-Commons Transports project. 

...

Anchor
enableMailTo
enableMailTo
To enable the MailTo transport sender

Edit the <EI_HOME>/conf/axis2/axis2.xml file and uncomment the MailTo sender as follows:

Code Block
languagehtml/xml
<transportSender name="mailto" class="org.apache.axis2.transport.mail.MailTransportSender">
    <parameter name="mail.smtp.host">smtp.gmail.com</parameter>
    <parameter name="mail.smtp.port">587</parameter>
    <parameter name="mail.smtp.starttls.enable">true</parameter>
    <parameter name="mail.smtp.auth">true</parameter>
    <parameter name="mail.smtp.user">synapse.demo.0</parameter>
    <parameter name="mail.smtp.password">mailpassword</parameter>
    <parameter name="mail.smtp.from">synapse.demo.0@gmail.com</parameter>
</transportSender>
Note

Be sure to import the SSL certificate of your SMTP host server (specified by the mail.smtp.host parameter) to the client trust store of your ESB. The ESB will use the trusted certificates in this client trust store to validate the identity of the SMTP server.

When importing the certificate, be sure to use a certificate alias that is relevant to your server. For example, if you are using Gmail, use 'smtp.gmail.com' as the certificate alias. See the instructions on importing certificates to a keystore.

Info
titleNote

If you want to use multiple mail boxes to send emails, you can have multiple MailTo senders in the <EI_HOME>/conf/axis2/axis2.xml file and include the name of the relevant <transportSender> in the synapse configuration to use a particular mail box.

For example, if you edit the <EI_HOME>/conf/axis2/axis2.xml file and add the following <transportSender>:

Code Block
<transportSender name="mailtoWSO2" class="org.apache.axis2.transport.mail.MailTransportSender">
        <parameter name="mail.smtp.host">smtp.gmail.com</parameter>
        <parameter name="mail.smtp.port">587</parameter>
        <parameter name="mail.smtp.starttls.enable">true</parameter>
        <parameter name="mail.smtp.auth">true</parameter>
        <parameter name="mail.smtp.user">synapse.demo.0</parameter>
        <parameter name="mail.smtp.password">mailpassword</parameter>
        <parameter name="mail.smtp.from">synapse.demo.0@gmail.com</parameter>
</transportSender>

 You can use the mailtoWSO2 mail box by specifying the following in a synapse configuration:

Code Block
<endpoint>
     <address uri="mailtoWSO2:user@host"/>
</endpoint>

...

Parameter Name

Description

e.g.Required

Possible Values

Default Value

transport.mail.Address

The mail address from which this service should fetch incoming mails.

Yes

A valid e-mail address


transport.mail.bodyWhenAttached

The content for the body of the mail when sending a mail with an attachment.

NoThe text you want to appear in the mail body

transport.mail.Folder

The mail folder in the server from which the listener should fetch incoming mails.

No

A valid mail folder name (e.g., inbox)

inbox folder if that is available or else the root folder

transport.mail.Protocol

The mail protocol to be used to receive messages.

No

pop3, imap

imap

transport.mail.PreserveHeaders

A comma separated list of mail header names that this receiver should preserve in all incoming messages.

No

A comma separated list


transport.mail.RemoveHeaders

A comma separated list of mail header names that this receiver should remove from incoming messages.

No

A comma separated list


transport.mail.ActionAfterProcess

Action to perform on the mails after processing them.

No

MOVE, DELETE

DELETE

transport.mail.ActionAfterFailure

Action to perform on the mails after a failure occurs while processing them.

No

MOVE, DELETE

DELETE

transport.mail.MoveAfterProcess

Folder to move the mails after processing them.

Required if ActionAfterProcess is MOVE

A valid mail folder name


transport.mail.MoveAfterFailure

Folder to move the mails after encountering a failure.

Required if ActionAfterFailure is MOVE

A valid mail folder name


transport.mail.ProcessInParallel

Whether the receiver should process incoming mails in parallel or not. This works only if the mail protocol supports processing incoming mails in parallel. (e.g., IMAP)

No

true, false

false

transport.ConcurrentPollingAllowed

Whether the receiver should poll for multiple messages concurrently.

No

true, false

false

transport.mail.MaxRetryCount

Maximum number of retry operations to be performed when fetching incoming mails.

Yes

A positive integer


transport.mail.ReconnectTimeout

The reconnect timeout in milliseconds to be used when fetching incoming mails.

Yes

A positive integer


...

Parameter Name

Description

Required

Possible Values

Default Value

transport.mail.SMTPBccAddresses

If one or more e-mail addresses need to be specified as BCC addresses for outgoing mails, this parameter can be used.

No

A comma-separated list of e-mail addresses


transport.mail.Format

Format of the outgoing mail.

No

Text, Multipart

Text

...