JBI Support deprecated in Apache ServiceMix 4

JBI 1.0 support is available in Apache ServiceMix 4 to allow existing users to migrate more easily to this latest version - if you're a new user, you should consider JBI deprecated and not use it for your project. Take a look at our technology selection guidelines for more information.

servicemix-mail

Overview

he ServiceMix Mail component provides support for receiving and sending mails via the enterprise service bus.

Namespace and xbean.xml

The namespace URI for the servicemix-bean JBI component is http://servicemix.apache.org/mail/1.0. This is an example of an xbean.xml file with a namespace definition with prefix bean.

<beans xmlns:mail="http://servicemix.apache.org/mail/1.0">

  <!-- add mail:poller and mail:sender definitions here -->

</beans>

Endpoint types

The servicemix-mail component defines two endpoint type:

  • mail:poller :: Connect to a POP3 or IMAP server and send a MessageExchange for every mail

  • mail:sender :: Connect to an SMTP server and send a mail for every JBI MessageExchange it receives

mail:poller

Endpoint properties

Property Name Type Description
concurrentPolling boolean Sets whether more than one poll can be active at a time (true means yes). Default value is <code>false</code>.
connection java.lang.String <p>Specifies the connection URI used to connect to a mail server. <br /><br /> <b><u>Templates:</u></b> <br />  nbsp; i><rotocol>//<ser><ost>:<ort>/<older>?password=<assword>/i> <br /><b> nbsp; nbsp; nbsp;OR</b><br/>  nbsp; i><rotocol>//<ost>:<ort>/<older>?user=<ser>password=<assword>/i> <br /><br /> <b><u>Details:</u></b><br /><br/> <table border="0" cellpadding="0" cellspacing="0"> <tr> <td width="40%" align="left"><b><u>Name</u></b></td> <td width="60%" align="left"><b><u>Description</u></b></td> </tr> <tr> <td>protocol</td> <td>the protocol to use (example: pop3 or imap)</td> </tr> <tr> <td>user</td> <td>the user name used to log into an account</td> </tr> <tr> <td>host</td> <td>the name or ip address of the mail server</td> </tr> <tr> <td>port</td> <td>the port number to use (optional)</td> </tr> <tr> <td>folder</td> <td>the folder to poll from (optional)</td> </tr> <tr> <td>password</td> <td>the password for the login</td> </tr> </table> <br/> <b><u>Examples:</u></b><br />  nbsp; i>imap://lhein@imapserver:143/INBOX?password=mypass</i><br />  nbsp; i>pop3://pop3server/INBOX?user=me@myhome.org;password=mypass</i></p> <i> nbsp; he default value is <b>null</b></i><br/><br/>
customProperties java.util.Map <p>Specifies a <code>java.util.Map</code> which may contain additional properties for the connection. <br/> <br/><b><u>Example for disabling TOP for POP3 headers:</u></b><br />  i><b>key</b>: "mail.pop3.disabletop"</i> <br />  i><b>value</b>: "true"</i></p> <i> nbsp; he default value is <b>null</b></i><br/><br/>
customTrustManagers java.lang.String <p>Specifies one or more trust manager classes separated by a semicolon (<b>;</b>).<br/> These classes have to implement the <code>Trustmanager</code> interface and need to provide an empty default constructor to be valid.<br/><br /> If you want to accept all security certificates without a check you may consider using the <code>DummyTrustManager</code> class. It is actually only an empty stub without any checking logic. <br/><b>But be aware that this will be a security risk in production environments. </b></p> <i> nbsp; he default value is <b>null</b></i><br/><br/>
debugMode boolean <p>Specifies if the JavaMail is run in <code>DEBUG</code> mode. This means that while connecting to server and processing mails a detailed log is written to debug output. <br /> This mode is very handy if you are experiencing problems with your mail server connection and you want to find out what is going wrong in communication with the server. <br /><br />  nbsp; b>true</b> - <i>the debug mode is <b>enabled</b></i> <br />  nbsp; b>false</b> - <i>the debug mode is <b>disabled</b></i></p> <i> nbsp; he default value is <b>false</b></i><br/><br/>
delay long Sets the amount of time in milliseconds that the endpoint should wait before making the first poll.
deleteProcessedMessages boolean <p>This flag is used to indicate what happens to a processed mail polled from a mail folder. If it is set to <code>true</code> the mail will be deleted after it was sent into the bus successfully. If set to <code>false</code> the mail will reside inside the mail folder but will be marked as already seen.<br/> If the sending of the mail results in an error, the mail will not be deleted / marked and reprocessed on next run of the polling cycle.<p> <i> nbsp; he default value is <b>false</b></i>
endpoint java.lang.String The name of the endpoint.
firstTime java.util.Date Sets the date on which the first poll will be executed. If a delay is also set using <code>setDelay</code>, the delay interval will be added after the date specified.
interfaceName javax.xml.namespace.QName The qualified name of the interface exposed by the endpoint.
marshaler org.apache.servicemix.mail.marshaler.AbstractMailMarshaler <p>With this method you can specify a marshaler class which provides the logic for converting a mail into a normalized message. This class has to extend the abstract class <code>AbstractMailMarshaler</code> or an extending class. If you don't specify a marshaler, the <code>DefaultMailMarshaler</code> will be used.</p>
maxFetchSize int <p>This sets the maximum amount of mails to process within one polling cycle. If the maximum amount is reached all other mails in "unseen" state will be skipped.</p> <i> nbsp; he default value is <b>-1 (unlimited)</b></i><br/><br/>
period long Sets the number of milliseconds between polling attempts.
processOnlyUnseenMessages boolean <p>This flag is used to indicate whether all mails are polled from a mail folder or only the unseen mails are processed.<br/><br /> If it is set to <b><code>true</code></b> only the unseen mails will be processed.<br /> If it is set to <b><code>false</code></b> all mails will be processed.<br/></p> <i> nbsp; he default value is <b>true</b></i><br/><br/>
scheduler org.apache.servicemix.common.scheduler.Scheduler Set a custom Scheduler implementation if you need more fine-grained control over the polling schedule.
service javax.xml.namespace.QName The qualified name of the service the endpoint exposes.
storage org.apache.servicemix.store.Store <p>Specifies a <code>org.apache.servicemix.store.Store</code> object which will be used for storing the identifications of already processed messages.<br/> <b>This store is only used with the POP3 protocol and if unseen mails are processed only.</b></p> <i> nbsp; he default value is <b>null</b></i><br/><br/>
targetEndpoint java.lang.String the name of the endpoint to which requests are sent
targetInterface javax.xml.namespace.QName the QName of the interface to which requests are sent
targetOperation javax.xml.namespace.QName the QName of the operation to which requests are sent
targetService javax.xml.namespace.QName the QName of the service to which requests are sent
targetUri java.lang.String Set the target service/endpoint/interface using a URI.

mail:sender

Endpoint properties

Property Name Type Description
connection java.lang.String <p>Specifies the connection URI used to connect to a mail server. <br /><br /> <b><u>Templates:</u></b> <br />  nbsp; i><rotocol>//<ser><ost>:<ort>/<older>?password=<assword>/i> <br /><b> nbsp; nbsp; nbsp;OR</b><br/>  nbsp; i><rotocol>//<ost>:<ort>/<older>?user=<ser>password=<assword>/i> <br /><br /> <b><u>Details:</u></b><br /><br/> <table border="0" cellpadding="0" cellspacing="0"> <tr> <td width="40%" align="left"><b><u>Name</u></b></td> <td width="60%" align="left"><b><u>Description</u></b></td> </tr> <tr> <td>protocol</td> <td>the protocol to use (example: pop3 or imap)</td> </tr> <tr> <td>user</td> <td>the user name used to log into an account</td> </tr> <tr> <td>host</td> <td>the name or ip address of the mail server</td> </tr> <tr> <td>port</td> <td>the port number to use (optional)</td> </tr> <tr> <td>folder</td> <td>the folder to poll from (optional)</td> </tr> <tr> <td>password</td> <td>the password for the login</td> </tr> </table> <br/> <b><u>Example:</u></b><br />  nbsp; i>smtp://lhein@myserver?password=myPass</i><br /></p> <i> nbsp; he default value is <b>null</b></i><br/><br/>
customProperties java.util.Map <p>Specifies a <code>java.util.Map</code> which may contain additional properties for the connection. <br/> <br/><b><u>Example for disabling TOP for POP3 headers:</u></b><br />  i><b>key</b>: "mail.pop3.disabletop"</i> <br />  i><b>value</b>: "true"</i></p> <i> nbsp; he default value is <b>null</b></i><br/><br/>
customTrustManagers java.lang.String <p>Specifies one or more trust manager classes separated by a semicolon (<b>;</b>).<br/> These classes have to implement the <code>Trustmanager</code> interface and need to provide an empty default constructor to be valid.<br/><br /> If you want to accept all security certificates without a check you may consider using the <code>DummyTrustManager</code> class. It is actually only an empty stub without any checking logic. <br/><b>But be aware that this will be a security risk in production environments. </b></p> <i> nbsp; he default value is <b>null</b></i><br/><br/>
debugMode boolean <p>Specifies if the JavaMail is run in <code>DEBUG</code> mode. This means that while connecting to server and processing mails a detailed log is written to debug output. <br /> This mode is very handy if you are experiencing problems with your mail server connection and you want to find out what is going wrong in communication with the server. <br /><br />  nbsp; b>true</b> - <i>the debug mode is <b>enabled</b></i> <br />  nbsp; b>false</b> - <i>the debug mode is <b>disabled</b></i></p> <i> nbsp; he default value is <b>false</b></i><br/><br/>
endpoint java.lang.String The name of the endpoint.
ignoreMessageProperties (java.lang.Object)\* <p>Specifies a <code>java.util.List</code> which may contain message properties to skip. <br/> <br/><b><u>Example for skipping all kind of addresses from the normalized message:</u></b><br />  i><b>value</b>: "org.apache.servicemix.mail.to"</i> <br />  i><b>value</b>: "org.apache.servicemix.mail.cc"</i> <br />  i><b>value</b>: "org.apache.servicemix.mail.bcc"</i> <br />  i><b>value</b>: "org.apache.servicemix.mail.from"</i> <br />  i><b>value</b>: "org.apache.servicemix.mail.replyto"</i> <br /></p> <i> nbsp; he default value is <b>null</b></i><br/><br/>
interfaceName javax.xml.namespace.QName The qualified name of the interface exposed by the endpoint.
marshaler org.apache.servicemix.mail.marshaler.AbstractMailMarshaler <p>With this method you can specify a marshaler class which provides the logic for converting a normalized message into a mail. This class has to extend the abstract class <code>AbstractMailMarshaler</code> or an extending class. If you don't specify a marshaler, the <code>DefaultMailMarshaler</code> will be used.</p>
receiver java.lang.String <p>Specifies the receiver address(es) of the mail which is being sent.</p> <i> nbsp; he default value is <b>null</b></i><br/><br/>
sender java.lang.String <p>Specifies the sender address of the mail which is being sent.</p> <i> nbsp; he default value is <b>no-reply@localhost</b></i><br/><br/>
service javax.xml.namespace.QName The qualified name of the service the endpoint exposes.