You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@camel.apache.org by bu...@apache.org on 2017/08/25 10:20:14 UTC

svn commit: r1017269 [9/11] - in /websites/production/camel/content: ./ cache/

Modified: websites/production/camel/content/mail.html
==============================================================================
--- websites/production/camel/content/mail.html (original)
+++ websites/production/camel/content/mail.html Fri Aug 25 10:20:13 2017
@@ -36,17 +36,6 @@
     <![endif]-->
 
 
-  <link href='//camel.apache.org/styles/highlighter/styles/shCoreCamel.css' rel='stylesheet' type='text/css' />
-  <link href='//camel.apache.org/styles/highlighter/styles/shThemeCamel.css' rel='stylesheet' type='text/css' />
-  <script src='//camel.apache.org/styles/highlighter/scripts/shCore.js' type='text/javascript'></script>
-  <script src='//camel.apache.org/styles/highlighter/scripts/shBrushJava.js' type='text/javascript'></script>
-  <script src='//camel.apache.org/styles/highlighter/scripts/shBrushXml.js' type='text/javascript'></script>
-  <script src='//camel.apache.org/styles/highlighter/scripts/shBrushPlain.js' type='text/javascript'></script>
-  
-  <script type="text/javascript">
-  SyntaxHighlighter.defaults['toolbar'] = false;
-  SyntaxHighlighter.all();
-  </script>
 
     <title>
     Apache Camel: Mail
@@ -86,152 +75,65 @@
 	<tbody>
         <tr>
         <td valign="top" width="100%">
-<div class="wiki-content maincontent"><h2 id="Mail-MailComponent">Mail Component</h2><p>The mail component provides access to Email via Spring's Mail support and the underlying JavaMail system.</p><p>Maven users will need to add the following dependency to their <code>pom.xml</code> for this component:</p><div class="code panel pdl" style="border-width: 1px;"><div class="codeContent panelContent pdl">
-<script class="brush: xml; gutter: false; theme: Default" type="syntaxhighlighter"><![CDATA[&lt;dependency&gt;
+<div class="wiki-content maincontent"><h2 id="Mail-MailComponent">Mail Component</h2><p>The mail component provides access to Email via Spring's Mail support and the underlying JavaMail system.</p><p>Maven users will need to add the following dependency to their <code>pom.xml</code> for this component:</p><parameter ac:name="">xml</parameter><plain-text-body>&lt;dependency&gt;
     &lt;groupId&gt;org.apache.camel&lt;/groupId&gt;
     &lt;artifactId&gt;camel-mail&lt;/artifactId&gt;
     &lt;version&gt;x.x.x&lt;/version&gt;
     &lt;!-- use the same version as your Camel core version --&gt;
 &lt;/dependency&gt;
-]]></script>
-</div></div><div class="confluence-information-macro confluence-information-macro-warning"><p class="title">Geronimo mail .jar</p><span class="aui-icon aui-icon-small aui-iconfont-error confluence-information-macro-icon"></span><div class="confluence-information-macro-body"><p>We have discovered that the geronimo mail <code>.jar</code> (v1.6) has a bug when polling mails with attachments. It cannot correctly identify the <code>Content-Type</code>. So, if you attach a <code>.jpeg</code> file to a mail and you poll it, the <code>Content-Type</code> is resolved as <code>text/plain</code> and not as <code>image/jpeg</code>. For that reason, we have added an <code>org.apache.camel.component.ContentTypeResolver</code> SPI interface which enables you to provide your own implementation and fix this bug by returning the correct Mime type based on the file name. So if the file name ends with <code>jpeg/jpg</code>, you can return <code>image/jpeg</code>.</p><p>You can set your custom resolver 
 on the <code>MailComponent</code> instance or on the <code>MailEndpoint</code> instance.</p></div></div><div class="confluence-information-macro confluence-information-macro-tip"><p class="title">POP3 or IMAP</p><span class="aui-icon aui-icon-small aui-iconfont-approve confluence-information-macro-icon"></span><div class="confluence-information-macro-body"><p>POP3 has some limitations and end users are encouraged to use IMAP if possible.</p></div></div><div class="confluence-information-macro confluence-information-macro-information"><p class="title">Using mock-mail for testing</p><span class="aui-icon aui-icon-small aui-iconfont-info confluence-information-macro-icon"></span><div class="confluence-information-macro-body"><p>You can use a mock framework for unit testing, which allows you to test without the need for a real mail server. However you should remember to not include the mock-mail when you go into production or other environments where you need to send mails to a real mai
 l server. Just the presence of the mock-javamail.jar on the classpath means that it will kick in and avoid sending the mails.</p></div></div><h3 id="Mail-URIformat">URI format</h3><p>Mail endpoints can have one of the following URI formats (for the protocols, SMTP, POP3, or IMAP, respectively):</p><div class="code panel pdl" style="border-width: 1px;"><div class="codeContent panelContent pdl">
-<script class="brush: java; gutter: false; theme: Default" type="syntaxhighlighter"><![CDATA[smtp://[username@]host[:port][?options]
+</plain-text-body><parameter ac:name="title">Geronimo mail .jar</parameter><rich-text-body><p>We have discovered that the geronimo mail <code>.jar</code> (v1.6) has a bug when polling mails with attachments. It cannot correctly identify the <code>Content-Type</code>. So, if you attach a <code>.jpeg</code> file to a mail and you poll it, the <code>Content-Type</code> is resolved as <code>text/plain</code> and not as <code>image/jpeg</code>. For that reason, we have added an <code>org.apache.camel.component.ContentTypeResolver</code> SPI interface which enables you to provide your own implementation and fix this bug by returning the correct Mime type based on the file name. So if the file name ends with <code>jpeg/jpg</code>, you can return <code>image/jpeg</code>.</p><p>You can set your custom resolver on the <code>MailComponent</code> instance or on the <code>MailEndpoint</code> instance.</p></rich-text-body><parameter ac:name="title">POP3 or IMAP</parameter><rich-text-body><p>POP3 
 has some limitations and end users are encouraged to use IMAP if possible.</p></rich-text-body><parameter ac:name="title">Using mock-mail for testing</parameter><rich-text-body><p>You can use a mock framework for unit testing, which allows you to test without the need for a real mail server. However you should remember to not include the mock-mail when you go into production or other environments where you need to send mails to a real mail server. Just the presence of the mock-javamail.jar on the classpath means that it will kick in and avoid sending the mails.</p></rich-text-body><h3 id="Mail-URIformat">URI format</h3><p>Mail endpoints can have one of the following URI formats (for the protocols, SMTP, POP3, or IMAP, respectively):</p><plain-text-body>smtp://[username@]host[:port][?options]
 pop3://[username@]host[:port][?options]
 imap://[username@]host[:port][?options]
-]]></script>
-</div></div><p>The mail component also supports secure variants of these protocols (layered over SSL). You can enable the secure protocols by adding <code>s</code> to the scheme:</p><div class="code panel pdl" style="border-width: 1px;"><div class="codeContent panelContent pdl">
-<script class="brush: java; gutter: false; theme: Default" type="syntaxhighlighter"><![CDATA[smtps://[username@]host[:port][?options]
+</plain-text-body><p>The mail component also supports secure variants of these protocols (layered over SSL). You can enable the secure protocols by adding <code>s</code> to the scheme:</p><plain-text-body>smtps://[username@]host[:port][?options]
 pop3s://[username@]host[:port][?options]
 imaps://[username@]host[:port][?options]
-]]></script>
-</div></div><p>You can append query options to the URI in the following format, <code>?option=value&amp;option=value&amp;...</code></p><h4 id="Mail-Sampleendpoints">Sample endpoints</h4><p>Typically, you specify a URI with login credentials as follows (taking SMTP as an example):</p><div class="code panel pdl" style="border-width: 1px;"><div class="codeContent panelContent pdl">
-<script class="brush: java; gutter: false; theme: Default" type="syntaxhighlighter"><![CDATA[smtp://[username@]host[:port][?password=somepwd]
-]]></script>
-</div></div><p>Alternatively, it is possible to specify both the user name and the password as query options:</p><div class="code panel pdl" style="border-width: 1px;"><div class="codeContent panelContent pdl">
-<script class="brush: java; gutter: false; theme: Default" type="syntaxhighlighter"><![CDATA[smtp://host[:port]?password=somepwd&amp;username=someuser
-]]></script>
-</div></div><p>For example:</p><div class="code panel pdl" style="border-width: 1px;"><div class="codeContent panelContent pdl">
-<script class="brush: java; gutter: false; theme: Default" type="syntaxhighlighter"><![CDATA[smtp://mycompany.mailserver:30?password=tiger&amp;username=scott
-]]></script>
-</div></div><h4 id="Mail-DefaultPortsDefaultports"><span class="confluence-anchor-link" id="Mail-DefaultPorts"></span>Default ports</h4><p>Default port numbers are supported. If the port number is omitted, Camel determines the port number to use based on the protocol.</p><div class="confluenceTableSmall"><div class="table-wrap"><table class="confluenceTable"><tbody><tr><th colspan="1" rowspan="1" class="confluenceTh"><p>Protocol</p></th><th colspan="1" rowspan="1" class="confluenceTh"><p>Default Port Number</p></th></tr><tr><td colspan="1" rowspan="1" class="confluenceTd"><p><code>SMTP</code></p></td><td colspan="1" rowspan="1" class="confluenceTd"><p><code>25</code></p></td></tr><tr><td colspan="1" rowspan="1" class="confluenceTd"><p><code>SMTPS</code></p></td><td colspan="1" rowspan="1" class="confluenceTd"><p><code>465</code></p></td></tr><tr><td colspan="1" rowspan="1" class="confluenceTd"><p><code>POP3</code></p></td><td colspan="1" rowspan="1" class="confluenceTd"><p><code>110
 </code></p></td></tr><tr><td colspan="1" rowspan="1" class="confluenceTd"><p><code>POP3S</code></p></td><td colspan="1" rowspan="1" class="confluenceTd"><p><code>995</code></p></td></tr><tr><td colspan="1" rowspan="1" class="confluenceTd"><p><code>IMAP</code></p></td><td colspan="1" rowspan="1" class="confluenceTd"><p><code>143</code></p></td></tr><tr><td colspan="1" rowspan="1" class="confluenceTd"><p><code>IMAPS</code></p></td><td colspan="1" rowspan="1" class="confluenceTd"><p><code>993</code></p></td></tr></tbody></table></div></div>
-
-
-<h3 id="Mail-Options">Options</h3><div class="confluenceTableSmall"><div class="table-wrap"><table class="confluenceTable"><tbody><tr><th colspan="1" rowspan="1" class="confluenceTh"><p>Property</p></th><th colspan="1" rowspan="1" class="confluenceTh"><p>Default</p></th><th colspan="1" rowspan="1" class="confluenceTh"><p>Description</p></th></tr><tr><td colspan="1" rowspan="1" class="confluenceTd"><p><code>host</code></p></td><td colspan="1" rowspan="1" class="confluenceTd"><p>&#160;</p></td><td colspan="1" rowspan="1" class="confluenceTd"><p>The host name or IP address to connect to.</p></td></tr><tr><td colspan="1" rowspan="1" class="confluenceTd"><p><code>port</code></p></td><td colspan="1" rowspan="1" class="confluenceTd"><p>See <a shape="rect" href="#Mail-DefaultPorts">#DefaultPorts</a></p></td><td colspan="1" rowspan="1" class="confluenceTd"><p>The TCP port number to connect on.</p></td></tr><tr><td colspan="1" rowspan="1" class="confluenceTd"><p><code>username</code></p></td>
 <td colspan="1" rowspan="1" class="confluenceTd"><p>&#160;</p></td><td colspan="1" rowspan="1" class="confluenceTd"><p>The user name on the email server.</p></td></tr><tr><td colspan="1" rowspan="1" class="confluenceTd"><p><code>password</code></p></td><td colspan="1" rowspan="1" class="confluenceTd"><p><code>null</code></p></td><td colspan="1" rowspan="1" class="confluenceTd"><p>The password on the email server.</p></td></tr><tr><td colspan="1" rowspan="1" class="confluenceTd"><p><code>ignoreUriScheme</code></p></td><td colspan="1" rowspan="1" class="confluenceTd"><p><code>false</code></p></td><td colspan="1" rowspan="1" class="confluenceTd"><p>If <code>false</code>, Camel uses the scheme to determine the transport protocol (POP, IMAP, SMTP etc.)</p></td></tr><tr><td colspan="1" rowspan="1" class="confluenceTd"><p><code>contentType</code></p></td><td colspan="1" rowspan="1" class="confluenceTd"><p><code>text/plain</code></p></td><td colspan="1" rowspan="1" class="confluenceTd"><p>T
 he mail message content type. Use <code>text/html</code> for HTML mails.</p></td></tr><tr><td colspan="1" rowspan="1" class="confluenceTd"><p><code>folderName</code></p></td><td colspan="1" rowspan="1" class="confluenceTd"><p><code>INBOX</code></p></td><td colspan="1" rowspan="1" class="confluenceTd"><p>The folder to poll.</p></td></tr><tr><td colspan="1" rowspan="1" class="confluenceTd"><p><code>destination</code></p></td><td colspan="1" rowspan="1" class="confluenceTd"><p><code>username@host</code></p></td><td colspan="1" rowspan="1" class="confluenceTd"><p><strong>@deprecated</strong> Use the <code>to</code> option instead. The <code>TO</code> recipients (receivers of the email).</p></td></tr><tr><td colspan="1" rowspan="1" class="confluenceTd"><p><code>to</code></p></td><td colspan="1" rowspan="1" class="confluenceTd"><p><code>username@host</code></p></td><td colspan="1" rowspan="1" class="confluenceTd"><p>The TO recipients (the receivers of the mail). Separate multiple email ad
 dresses with a comma. Email addresses containing special characters such as "&amp;" will need to be handled differently - see <a shape="rect" href="how-do-i-configure-password-options-on-camel-endpoints-without-the-value-being-encoded.html">How do I configure password options on Camel endpoints without the value being encoded</a>.</p></td></tr><tr><td colspan="1" rowspan="1" class="confluenceTd"><p><code>replyTo</code></p></td><td colspan="1" rowspan="1" class="confluenceTd"><p><code>alias@host</code></p></td><td colspan="1" rowspan="1" class="confluenceTd"><p>As of <strong>Camel 2.8.4, 2.9.1+</strong>, the Reply-To recipients (the receivers of the response mail). Separate multiple email addresses with a comma.</p></td></tr><tr><td colspan="1" rowspan="1" class="confluenceTd"><p><code>cc</code></p></td><td colspan="1" rowspan="1" class="confluenceTd"><p><code>null</code></p></td><td colspan="1" rowspan="1" class="confluenceTd"><p>The CC recipients (the receivers of the mail). Separa
 te multiple email addresses with a comma.</p></td></tr><tr><td colspan="1" rowspan="1" class="confluenceTd"><p><code>bcc</code></p></td><td colspan="1" rowspan="1" class="confluenceTd"><p><code>null</code></p></td><td colspan="1" rowspan="1" class="confluenceTd"><p>The BCC recipients (the receivers of the mail). Separate multiple email addresses with a comma.</p></td></tr><tr><td colspan="1" rowspan="1" class="confluenceTd"><p><code>from</code></p></td><td colspan="1" rowspan="1" class="confluenceTd"><p><code>camel@localhost</code></p></td><td colspan="1" rowspan="1" class="confluenceTd"><p>The FROM email address.</p></td></tr><tr><td colspan="1" rowspan="1" class="confluenceTd"><p><code>subject</code></p></td><td colspan="1" rowspan="1" class="confluenceTd"><p>&#160;</p></td><td colspan="1" rowspan="1" class="confluenceTd"><p>As of <strong>Camel 2.3</strong>, the Subject of the message being sent. Note: Setting the subject in the header takes precedence over this option.</p></td></
 tr><tr><td colspan="1" rowspan="1" class="confluenceTd"><p><code>peek</code></p></td><td colspan="1" rowspan="1" class="confluenceTd"><p><code>true</code></p></td><td colspan="1" rowspan="1" class="confluenceTd"><p><strong>Camel 2.11.3/2.12.2:</strong> Consumer only. Will mark the <code>javax.mail.Message</code> as peeked before processing the mail message. This applies to <code>IMAPMessage</code> messages types only. By using peek the mail will not be eager marked as <code>SEEN</code> on the mail server, which allows us to rollback the mail message if there is an error processing in Camel.</p></td></tr><tr><td colspan="1" rowspan="1" class="confluenceTd"><p><code>delete</code></p></td><td colspan="1" rowspan="1" class="confluenceTd"><p><code>false</code></p></td><td colspan="1" rowspan="1" class="confluenceTd"><p>Deletes the messages after they have been processed. This is done by setting the <code>DELETED</code> flag on the mail message. If <code>false</code>, the <code>SEEN</code
 > flag is set instead. As of <strong>Camel 2.10</strong> you can override this configuration option by setting a header with the key <code>delete</code> to determine if the mail should be deleted or not.</p></td></tr><tr><td colspan="1" rowspan="1" class="confluenceTd"><p><code>unseen</code></p></td><td colspan="1" rowspan="1" class="confluenceTd"><p><code>true</code></p></td><td colspan="1" rowspan="1" class="confluenceTd"><p>It is possible to configure a consumer endpoint so that it processes only unseen messages (that is, new messages) or all messages. Note that Camel always skips deleted messages. The default option of <code>true</code> will filter to only unseen messages. POP3 does not support the <code>SEEN</code> flag, so this option is not supported in POP3; use IMAP instead. <strong>Important:</strong> This option is <strong>not</strong> in use if you also use <code>searchTerm</code> options. Instead if you want to disable unseen when using <code>searchTerm</code>'s then ad
 d <code>searchTerm.unseen=false</code> as a term.</p></td></tr><tr><td colspan="1" rowspan="1" class="confluenceTd"><p><code>copyTo</code></p></td><td colspan="1" rowspan="1" class="confluenceTd"><p><code>null</code></p></td><td colspan="1" rowspan="1" class="confluenceTd"><p><strong>Camel 2.10:</strong> Consumer only. After processing a mail message, it can be copied to a mail folder with the given name. You can override this configuration value, with a header with the key <code>copyTo</code>, allowing you to copy messages to folder names configured at runtime.</p></td></tr><tr><td colspan="1" rowspan="1" class="confluenceTd"><p><code>fetchSize</code></p></td><td colspan="1" rowspan="1" class="confluenceTd"><p><code>-1</code></p></td><td colspan="1" rowspan="1" class="confluenceTd"><p>Sets the maximum number of messages to consume during a poll. This can be used to avoid overloading a mail server, if a mailbox folder contains a lot of messages. Default value of <code>-1</code> mean
 s no fetch size and all messages will be consumed. Setting the value to 0 is a special corner case, where Camel will not consume any messages at all.</p></td></tr><tr><td colspan="1" rowspan="1" class="confluenceTd"><p><code>alternativeBodyHeader</code></p></td><td colspan="1" rowspan="1" class="confluenceTd"><p><code>CamelMailAlternativeBody</code></p></td><td colspan="1" rowspan="1" class="confluenceTd"><p>Specifies the key to an IN message header that contains an alternative email body. For example, if you send emails in <code>text/html</code> format and want to provide an alternative mail body for non-HTML email clients, set the alternative mail body with this key as a header.</p></td></tr><tr><td colspan="1" rowspan="1" class="confluenceTd"><p><code>debugMode</code></p></td><td colspan="1" rowspan="1" class="confluenceTd"><p><code>false</code></p></td><td colspan="1" rowspan="1" class="confluenceTd"><p>Enable debug mode on the underlying mail framework. The SUN Mail framework l
 ogs the debug messages to <code>System.out</code> by default.</p></td></tr><tr><td colspan="1" rowspan="1" class="confluenceTd"><p><code>connectionTimeout</code></p></td><td colspan="1" rowspan="1" class="confluenceTd"><p><code>30000</code></p></td><td colspan="1" rowspan="1" class="confluenceTd"><p>The connection timeout in milliseconds. Default is 30 seconds.</p></td></tr><tr><td colspan="1" rowspan="1" class="confluenceTd"><p><code>consumer.initialDelay</code></p></td><td colspan="1" rowspan="1" class="confluenceTd"><p><code>1000</code></p></td><td colspan="1" rowspan="1" class="confluenceTd"><p>Milliseconds before the polling starts.</p></td></tr><tr><td colspan="1" rowspan="1" class="confluenceTd"><p><code>consumer.delay</code></p></td><td colspan="1" rowspan="1" class="confluenceTd"><p><code>60000</code></p></td><td colspan="1" rowspan="1" class="confluenceTd"><p>Camel will poll the mailbox only once a minute by default to avoid overloading the mail server.</p></td></tr><tr><t
 d colspan="1" rowspan="1" class="confluenceTd"><p><code>consumer.useFixedDelay</code></p></td><td colspan="1" rowspan="1" class="confluenceTd"><p><code>false</code></p></td><td colspan="1" rowspan="1" class="confluenceTd"><p>Set to <code>true</code> to use a fixed delay between polls, otherwise fixed rate is used. See <a shape="rect" class="external-link" href="http://java.sun.com/j2se/1.5.0/docs/api/java/util/concurrent/ScheduledExecutorService.html" rel="nofollow">ScheduledExecutorService</a> in JDK for details.</p></td></tr><tr><td colspan="1" rowspan="1" class="confluenceTd"><p><code>disconnect</code></p></td><td colspan="1" rowspan="1" class="confluenceTd"><p><code>false</code></p></td><td colspan="1" rowspan="1" class="confluenceTd"><p><strong>Camel 2.8.3/2.9:</strong> Whether the consumer should disconnect after polling. If enabled this forces Camel to connect on each poll.</p></td></tr><tr><td colspan="1" rowspan="1" class="confluenceTd"><p><code>closeFolder</code></p></td><
 td colspan="1" rowspan="1" class="confluenceTd"><p><code>true</code></p></td><td colspan="1" rowspan="1" class="confluenceTd"><p><strong>Camel 2.10.4:</strong> Whether the consumer should close the folder after polling. Setting this option to <code>false</code> and having <code>disconnect=false</code> as well, then the consumer keep the folder open between polls.</p></td></tr><tr><td colspan="1" rowspan="1" class="confluenceTd"><p><code>mail.XXX</code></p></td><td colspan="1" rowspan="1" class="confluenceTd"><p><code>null</code></p></td><td colspan="1" rowspan="1" class="confluenceTd"><p>Set any <a shape="rect" class="external-link" href="http://java.sun.com/products/javamail/javadocs/index.html" rel="nofollow">additional java mail properties</a>. For instance if you want to set a special property when using POP3 you can now provide the option directly in the URI such as: <code>mail.pop3.forgettopheaders=true</code>. You can set multiple such options, for example: <code>mail.pop3.fo
 rgettopheaders=true&amp;mail.mime.encodefilename=true</code>.</p></td></tr><tr><td colspan="1" rowspan="1" class="confluenceTd"><p><code>mapMailMessage</code></p></td><td colspan="1" rowspan="1" class="confluenceTd"><p><code>true</code></p></td><td colspan="1" rowspan="1" class="confluenceTd"><p><strong>Camel 2.8:</strong> Specifies whether Camel should map the received mail message to Camel body/headers. If set to true, the body of the mail message is mapped to the body of the Camel IN message and the mail headers are mapped to IN headers. If this option is set to false then the IN message contains a raw <code>javax.mail.Message</code>. You can retrieve this raw message by calling <code>exchange.getIn().getBody(javax.mail.Message.class)</code>.</p></td></tr><tr><td colspan="1" rowspan="1" class="confluenceTd"><p><code>maxMessagesPerPoll</code></p></td><td colspan="1" rowspan="1" class="confluenceTd"><p><code>0</code></p></td><td colspan="1" rowspan="1" class="confluenceTd"><p>Speci
 fies the maximum number of messages to gather per poll. By default, no maximum is set. Can be used to set a limit of e.g. 1000 to avoid downloading thousands of files when the server starts up. Set a value of 0 or negative to disable this option.</p></td></tr><tr><td colspan="1" rowspan="1" class="confluenceTd"><p><code>javaMailSender</code></p></td><td colspan="1" rowspan="1" class="confluenceTd"><p><code>null</code></p></td><td colspan="1" rowspan="1" class="confluenceTd"><p>Specifies a pluggable <span style="color: rgb(34,34,34);">org.apache.camel.component.</span><span style="color: rgb(34,34,34);">mail.JavaMailSender</span> instance in order to use a custom email implementation.</p></td></tr><tr><td colspan="1" rowspan="1" class="confluenceTd"><p><code>ignoreUnsupportedCharset</code></p></td><td colspan="1" rowspan="1" class="confluenceTd"><p><code>false</code></p></td><td colspan="1" rowspan="1" class="confluenceTd"><p>Option to let Camel ignore unsupported charset in the loca
 l JVM when sending mails. If the charset is unsupported then <code>charset=XXX</code> (where <code>XXX</code> represents the unsupported charset) is removed from the <code>content-type</code> and it relies on the platform default instead.</p></td></tr><tr><td colspan="1" rowspan="1" class="confluenceTd"><p><code>sslContextParameters</code></p></td><td colspan="1" rowspan="1" class="confluenceTd"><p><code>null</code></p></td><td colspan="1" rowspan="1" class="confluenceTd"><p><strong>Camel 2.10:</strong> Reference to a <code>org.apache.camel.util.jsse.SSLContextParameters</code> in the <a shape="rect" class="external-link" href="http://camel.apache.org/registry.html">Registry</a>.&#160; This reference overrides any configured SSLContextParameters at the component level.&#160; See <a shape="rect" class="external-link" href="http://camel.apache.org/http4.html#HTTP4-UsingtheJSSEConfigurationUtility">Using the JSSE Configuration Utility</a>.</p></td></tr><tr><td colspan="1" rowspan="1" c
 lass="confluenceTd"><p><code>searchTerm</code></p></td><td colspan="1" rowspan="1" class="confluenceTd"><p><code>null</code></p></td><td colspan="1" rowspan="1" class="confluenceTd"><p><strong>Camel 2.11:</strong> Refers to a <code>javax.mail.search.SearchTerm</code> which allows to filter mails based on search criteria such as subject, body, from, sent after a certain date etc. See further below for examples.</p></td></tr><tr><td colspan="1" rowspan="1" class="confluenceTd"><p><code>searchTerm.xxx</code></p></td><td colspan="1" rowspan="1" class="confluenceTd"><p><code>null</code></p></td><td colspan="1" rowspan="1" class="confluenceTd"><p><strong>Camel 2.11:</strong> To configure search terms directly from the endpoint uri, which supports a limited number of terms defined by the <code>org.apache.camel.component.mail.SimpleSearchTerm</code> class. See further below for examples.</p></td></tr><tr><td colspan="1" rowspan="1" class="confluenceTd"><p class="p1"><code>sortTerm</code></p
 ></td><td colspan="1" rowspan="1" class="confluenceTd"><code>null</code></td><td colspan="1" rowspan="1" class="confluenceTd"><strong>Camel 2.15: </strong>To configure the sortTerms that <span>IMAP</span> supports to sort the searched mails<strong><strong>. </strong></strong>You may need to define an array of<p class="p1"><code>com.sun.mail.imap.sortTerm</code> i<span>n the registry first and #name to reference it in this URI option.</span></p><p class="p1"><strong>Camel 2.16:</strong> You can also specify a comma separated list of sort terms on the URI that Camel will convert internally. For example, to sort descending by date you would use <code>sortTerm=reverse,date</code>. You can use any of the sort terms defined in <a shape="rect" class="external-link" href="https://javamail.java.net/nonav/docs/api/com/sun/mail/imap/SortTerm.html" rel="nofollow">com.sun.mail.imap.SortTerm</a>.</p></td></tr><tr><td colspan="1" rowspan="1" class="confluenceTd"><p class="p1"><code>postProcessActi
 on</code></p></td><td colspan="1" rowspan="1" class="confluenceTd"><code>null</code></td><td colspan="1" rowspan="1" class="confluenceTd"><strong>Camel 2.15:</strong> Refers to a<code style="line-height: 1.4285715;">org.apache.camel.component.mail.</code><span style="line-height: 1.4285715;"><code>MailBoxPostProcessAction</code> for doing post processing tasks on the mailbox once the normal processing ended.</span></td></tr><tr><td colspan="1" rowspan="1" class="confluenceTd"><code>skipFailedMessage</code></td><td colspan="1" rowspan="1" class="confluenceTd"><code>false</code></td><td colspan="1" rowspan="1" class="confluenceTd"><strong>Camel 2.15.1:</strong> If the mail consumer cannot retrieve a given mail message, then this option allows to skip the message and move on to retrieve the next mail message. The default behavior would be the consumer throws an exception and no mails from the batch would be able to be routed by Camel.</td></tr><tr><td colspan="1" rowspan="1" class="con
 fluenceTd"><code>handleFailedMessage</code></td><td colspan="1" rowspan="1" class="confluenceTd"><code>false</code></td><td colspan="1" rowspan="1" class="confluenceTd"><strong>Camel 2.15.1:</strong> If the mail consumer cannot retrieve a given mail message, then this option allows to handle the caused exception by the consumer's error handler. By enable the bridge error handler on the consumer, then the Camel routing error handler can handle the exception instead. <span>The default behavior would be the consumer throws an exception and no mails from the batch would be able to be routed by Camel.</span></td></tr><tr><td colspan="1" rowspan="1" class="confluenceTd"><pre><span>dummyTrustManager</span></pre></td><td colspan="1" rowspan="1" class="confluenceTd"><code>false</code></td><td colspan="1" rowspan="1" class="confluenceTd"><strong>Camel 2.17:</strong>To use a dummy security setting for trusting all certificates. Should only be used for development mode, and not production.</td>
 </tr><tr><td colspan="1" rowspan="1" class="confluenceTd"><code>idempotentRepository</code></td><td colspan="1" rowspan="1" class="confluenceTd"><code>null</code></td><td colspan="1" rowspan="1" class="confluenceTd"><strong>Camel 2.17:</strong> A pluggable repository org.apache.camel.spi.IdempotentRepository which allows to cluster consuming from the same mailbox, and let the repository coordinate whether a mail message is valid for the consumer to process.</td></tr><tr><td colspan="1" rowspan="1" class="confluenceTd"><code>idempotentRepositoryRemoveOnCommit</code></td><td colspan="1" rowspan="1" class="confluenceTd"><code>true</code></td><td colspan="1" rowspan="1" class="confluenceTd"><strong>Camel 2.17:</strong> <span style="line-height: 1.42857;">When using idempotent repository, then when the mail message has been successfully processed and is committed, should the message id be removed from the idempotent repository (default) or be kept in the repository. By default its assume
 d the message id is unique and has no value to be kept in the repository, because the mail message will be marked as seen/moved or deleted to prevent it from being consumed again. And therefore having the message id stored in the idempotent repository has little value. However this option allows to store the message id, for whatever reason you may have.</span></td></tr><tr><td colspan="1" rowspan="1" class="confluenceTd"><code>mailUidGenerator</code></td><td colspan="1" rowspan="1" class="confluenceTd">&#160;</td><td colspan="1" rowspan="1" class="confluenceTd"><strong>Camel 2.17:</strong> A pluggable MailUidGenerator that allows to use custom logic to generate UUID of the mail message.</td></tr></tbody></table></div></div>
-
-
-<h3 id="Mail-SSLsupport">SSL support</h3><p>The underlying mail framework is responsible for providing SSL support. &#160;You may either configure SSL/TLS support by completely specifying the necessary Java Mail API configuration options, or you may provide a configured SSLContextParameters through the component or endpoint configuration.</p><h4 id="Mail-UsingtheJSSEConfigurationUtility">Using the JSSE Configuration Utility</h4><p>As of <strong>Camel 2.10</strong>, the mail component supports SSL/TLS configuration through the <a shape="rect" href="camel-configuration-utilities.html">Camel JSSE Configuration Utility</a>.&#160; This utility greatly decreases the amount of component specific code you need to write and is configurable at the endpoint and component levels.&#160; The following examples demonstrate how to use the utility with the mail component.</p><h5 id="Mail-Programmaticconfigurationoftheendpoint">Programmatic configuration of the endpoint</h5><div class="code panel pdl
 " style="border-width: 1px;"><div class="codeContent panelContent pdl">
-<script class="brush: java; gutter: false; theme: Default" type="syntaxhighlighter"><![CDATA[KeyStoreParameters ksp = new KeyStoreParameters();
-ksp.setResource(&quot;/users/home/server/truststore.jks&quot;);
-ksp.setPassword(&quot;keystorePassword&quot;);
+</plain-text-body><p>You can append query options to the URI in the following format, <code>?option=value&amp;option=value&amp;...</code></p><h4 id="Mail-Sampleendpoints">Sample endpoints</h4><p>Typically, you specify a URI with login credentials as follows (taking SMTP as an example):</p><plain-text-body>smtp://[username@]host[:port][?password=somepwd]
+</plain-text-body><p>Alternatively, it is possible to specify both the user name and the password as query options:</p><plain-text-body>smtp://host[:port]?password=somepwd&amp;username=someuser
+</plain-text-body><p>For example:</p><plain-text-body>smtp://mycompany.mailserver:30?password=tiger&amp;username=scott
+</plain-text-body><h4 id="Mail-DefaultPortsDefaultports"><parameter ac:name="">DefaultPorts</parameter>Default ports</h4><p>Default port numbers are supported. If the port number is omitted, Camel determines the port number to use based on the protocol.</p><parameter ac:name="class">confluenceTableSmall</parameter><rich-text-body><div class="table-wrap"><table class="confluenceTable"><tbody><tr><th colspan="1" rowspan="1" class="confluenceTh"><p>Protocol</p></th><th colspan="1" rowspan="1" class="confluenceTh"><p>Default Port Number</p></th></tr><tr><td colspan="1" rowspan="1" class="confluenceTd"><p><code>SMTP</code></p></td><td colspan="1" rowspan="1" class="confluenceTd"><p><code>25</code></p></td></tr><tr><td colspan="1" rowspan="1" class="confluenceTd"><p><code>SMTPS</code></p></td><td colspan="1" rowspan="1" class="confluenceTd"><p><code>465</code></p></td></tr><tr><td colspan="1" rowspan="1" class="confluenceTd"><p><code>POP3</code></p></td><td colspan="1" rowspan="1" class="
 confluenceTd"><p><code>110</code></p></td></tr><tr><td colspan="1" rowspan="1" class="confluenceTd"><p><code>POP3S</code></p></td><td colspan="1" rowspan="1" class="confluenceTd"><p><code>995</code></p></td></tr><tr><td colspan="1" rowspan="1" class="confluenceTd"><p><code>IMAP</code></p></td><td colspan="1" rowspan="1" class="confluenceTd"><p><code>143</code></p></td></tr><tr><td colspan="1" rowspan="1" class="confluenceTd"><p><code>IMAPS</code></p></td><td colspan="1" rowspan="1" class="confluenceTd"><p><code>993</code></p></td></tr></tbody></table></div></rich-text-body><h3 id="Mail-Options">Options</h3><parameter ac:name="class">confluenceTableSmall</parameter><rich-text-body><div class="table-wrap"><table class="confluenceTable"><tbody><tr><th colspan="1" rowspan="1" class="confluenceTh"><p>Property</p></th><th colspan="1" rowspan="1" class="confluenceTh"><p>Default</p></th><th colspan="1" rowspan="1" class="confluenceTh"><p>Description</p></th></tr><tr><td colspan="1" rowspan=
 "1" class="confluenceTd"><p><code>host</code></p></td><td colspan="1" rowspan="1" class="confluenceTd"><p>&#160;</p></td><td colspan="1" rowspan="1" class="confluenceTd"><p>The host name or IP address to connect to.</p></td></tr><tr><td colspan="1" rowspan="1" class="confluenceTd"><p><code>port</code></p></td><td colspan="1" rowspan="1" class="confluenceTd"><p>See <a shape="rect" href="#Mail-DefaultPorts">#DefaultPorts</a></p></td><td colspan="1" rowspan="1" class="confluenceTd"><p>The TCP port number to connect on.</p></td></tr><tr><td colspan="1" rowspan="1" class="confluenceTd"><p><code>username</code></p></td><td colspan="1" rowspan="1" class="confluenceTd"><p>&#160;</p></td><td colspan="1" rowspan="1" class="confluenceTd"><p>The user name on the email server.</p></td></tr><tr><td colspan="1" rowspan="1" class="confluenceTd"><p><code>password</code></p></td><td colspan="1" rowspan="1" class="confluenceTd"><p><code>null</code></p></td><td colspan="1" rowspan="1" class="confluence
 Td"><p>The password on the email server.</p></td></tr><tr><td colspan="1" rowspan="1" class="confluenceTd"><p><code>ignoreUriScheme</code></p></td><td colspan="1" rowspan="1" class="confluenceTd"><p><code>false</code></p></td><td colspan="1" rowspan="1" class="confluenceTd"><p>If <code>false</code>, Camel uses the scheme to determine the transport protocol (POP, IMAP, SMTP etc.)</p></td></tr><tr><td colspan="1" rowspan="1" class="confluenceTd"><p><code>contentType</code></p></td><td colspan="1" rowspan="1" class="confluenceTd"><p><code>text/plain</code></p></td><td colspan="1" rowspan="1" class="confluenceTd"><p>The mail message content type. Use <code>text/html</code> for HTML mails.</p></td></tr><tr><td colspan="1" rowspan="1" class="confluenceTd"><p><code>folderName</code></p></td><td colspan="1" rowspan="1" class="confluenceTd"><p><code>INBOX</code></p></td><td colspan="1" rowspan="1" class="confluenceTd"><p>The folder to poll.</p></td></tr><tr><td colspan="1" rowspan="1" class=
 "confluenceTd"><p><code>destination</code></p></td><td colspan="1" rowspan="1" class="confluenceTd"><p><code>username@host</code></p></td><td colspan="1" rowspan="1" class="confluenceTd"><p><strong>@deprecated</strong> Use the <code>to</code> option instead. The <code>TO</code> recipients (receivers of the email).</p></td></tr><tr><td colspan="1" rowspan="1" class="confluenceTd"><p><code>to</code></p></td><td colspan="1" rowspan="1" class="confluenceTd"><p><code>username@host</code></p></td><td colspan="1" rowspan="1" class="confluenceTd"><p>The TO recipients (the receivers of the mail). Separate multiple email addresses with a comma. Email addresses containing special characters such as "&amp;" will need to be handled differently - see <a shape="rect" href="how-do-i-configure-password-options-on-camel-endpoints-without-the-value-being-encoded.html">How do I configure password options on Camel endpoints without the value being encoded</a>.</p></td></tr><tr><td colspan="1" rowspan="1
 " class="confluenceTd"><p><code>replyTo</code></p></td><td colspan="1" rowspan="1" class="confluenceTd"><p><code>alias@host</code></p></td><td colspan="1" rowspan="1" class="confluenceTd"><p>As of <strong>Camel 2.8.4, 2.9.1+</strong>, the Reply-To recipients (the receivers of the response mail). Separate multiple email addresses with a comma.</p></td></tr><tr><td colspan="1" rowspan="1" class="confluenceTd"><p><code>cc</code></p></td><td colspan="1" rowspan="1" class="confluenceTd"><p><code>null</code></p></td><td colspan="1" rowspan="1" class="confluenceTd"><p>The CC recipients (the receivers of the mail). Separate multiple email addresses with a comma.</p></td></tr><tr><td colspan="1" rowspan="1" class="confluenceTd"><p><code>bcc</code></p></td><td colspan="1" rowspan="1" class="confluenceTd"><p><code>null</code></p></td><td colspan="1" rowspan="1" class="confluenceTd"><p>The BCC recipients (the receivers of the mail). Separate multiple email addresses with a comma.</p></td></tr><
 tr><td colspan="1" rowspan="1" class="confluenceTd"><p><code>from</code></p></td><td colspan="1" rowspan="1" class="confluenceTd"><p><code>camel@localhost</code></p></td><td colspan="1" rowspan="1" class="confluenceTd"><p>The FROM email address.</p></td></tr><tr><td colspan="1" rowspan="1" class="confluenceTd"><p><code>subject</code></p></td><td colspan="1" rowspan="1" class="confluenceTd"><p>&#160;</p></td><td colspan="1" rowspan="1" class="confluenceTd"><p>As of <strong>Camel 2.3</strong>, the Subject of the message being sent. Note: Setting the subject in the header takes precedence over this option.</p></td></tr><tr><td colspan="1" rowspan="1" class="confluenceTd"><p><code>peek</code></p></td><td colspan="1" rowspan="1" class="confluenceTd"><p><code>true</code></p></td><td colspan="1" rowspan="1" class="confluenceTd"><p><strong>Camel 2.11.3/2.12.2:</strong> Consumer only. Will mark the <code>javax.mail.Message</code> as peeked before processing the mail message. This applies to 
 <code>IMAPMessage</code> messages types only. By using peek the mail will not be eager marked as <code>SEEN</code> on the mail server, which allows us to rollback the mail message if there is an error processing in Camel.</p></td></tr><tr><td colspan="1" rowspan="1" class="confluenceTd"><p><code>delete</code></p></td><td colspan="1" rowspan="1" class="confluenceTd"><p><code>false</code></p></td><td colspan="1" rowspan="1" class="confluenceTd"><p>Deletes the messages after they have been processed. This is done by setting the <code>DELETED</code> flag on the mail message. If <code>false</code>, the <code>SEEN</code> flag is set instead. As of <strong>Camel 2.10</strong> you can override this configuration option by setting a header with the key <code>delete</code> to determine if the mail should be deleted or not.</p></td></tr><tr><td colspan="1" rowspan="1" class="confluenceTd"><p><code>unseen</code></p></td><td colspan="1" rowspan="1" class="confluenceTd"><p><code>true</code></p></
 td><td colspan="1" rowspan="1" class="confluenceTd"><p>It is possible to configure a consumer endpoint so that it processes only unseen messages (that is, new messages) or all messages. Note that Camel always skips deleted messages. The default option of <code>true</code> will filter to only unseen messages. POP3 does not support the <code>SEEN</code> flag, so this option is not supported in POP3; use IMAP instead. <strong>Important:</strong> This option is <strong>not</strong> in use if you also use <code>searchTerm</code> options. Instead if you want to disable unseen when using <code>searchTerm</code>'s then add <code>searchTerm.unseen=false</code> as a term.</p></td></tr><tr><td colspan="1" rowspan="1" class="confluenceTd"><p><code>copyTo</code></p></td><td colspan="1" rowspan="1" class="confluenceTd"><p><code>null</code></p></td><td colspan="1" rowspan="1" class="confluenceTd"><p><strong>Camel 2.10:</strong> Consumer only. After processing a mail message, it can be copied to a 
 mail folder with the given name. You can override this configuration value, with a header with the key <code>copyTo</code>, allowing you to copy messages to folder names configured at runtime.</p></td></tr><tr><td colspan="1" rowspan="1" class="confluenceTd"><p><code>fetchSize</code></p></td><td colspan="1" rowspan="1" class="confluenceTd"><p><code>-1</code></p></td><td colspan="1" rowspan="1" class="confluenceTd"><p>Sets the maximum number of messages to consume during a poll. This can be used to avoid overloading a mail server, if a mailbox folder contains a lot of messages. Default value of <code>-1</code> means no fetch size and all messages will be consumed. Setting the value to 0 is a special corner case, where Camel will not consume any messages at all.</p></td></tr><tr><td colspan="1" rowspan="1" class="confluenceTd"><p><code>alternativeBodyHeader</code></p></td><td colspan="1" rowspan="1" class="confluenceTd"><p><code>CamelMailAlternativeBody</code></p></td><td colspan="1" 
 rowspan="1" class="confluenceTd"><p>Specifies the key to an IN message header that contains an alternative email body. For example, if you send emails in <code>text/html</code> format and want to provide an alternative mail body for non-HTML email clients, set the alternative mail body with this key as a header.</p></td></tr><tr><td colspan="1" rowspan="1" class="confluenceTd"><p><code>debugMode</code></p></td><td colspan="1" rowspan="1" class="confluenceTd"><p><code>false</code></p></td><td colspan="1" rowspan="1" class="confluenceTd"><p>Enable debug mode on the underlying mail framework. The SUN Mail framework logs the debug messages to <code>System.out</code> by default.</p></td></tr><tr><td colspan="1" rowspan="1" class="confluenceTd"><p><code>connectionTimeout</code></p></td><td colspan="1" rowspan="1" class="confluenceTd"><p><code>30000</code></p></td><td colspan="1" rowspan="1" class="confluenceTd"><p>The connection timeout in milliseconds. Default is 30 seconds.</p></td></tr
 ><tr><td colspan="1" rowspan="1" class="confluenceTd"><p><code>consumer.initialDelay</code></p></td><td colspan="1" rowspan="1" class="confluenceTd"><p><code>1000</code></p></td><td colspan="1" rowspan="1" class="confluenceTd"><p>Milliseconds before the polling starts.</p></td></tr><tr><td colspan="1" rowspan="1" class="confluenceTd"><p><code>consumer.delay</code></p></td><td colspan="1" rowspan="1" class="confluenceTd"><p><code>60000</code></p></td><td colspan="1" rowspan="1" class="confluenceTd"><p>Camel will poll the mailbox only once a minute by default to avoid overloading the mail server.</p></td></tr><tr><td colspan="1" rowspan="1" class="confluenceTd"><p><code>consumer.useFixedDelay</code></p></td><td colspan="1" rowspan="1" class="confluenceTd"><p><code>false</code></p></td><td colspan="1" rowspan="1" class="confluenceTd"><p>Set to <code>true</code> to use a fixed delay between polls, otherwise fixed rate is used. See <a shape="rect" class="external-link" href="http://java.
 sun.com/j2se/1.5.0/docs/api/java/util/concurrent/ScheduledExecutorService.html" rel="nofollow">ScheduledExecutorService</a> in JDK for details.</p></td></tr><tr><td colspan="1" rowspan="1" class="confluenceTd"><p><code>disconnect</code></p></td><td colspan="1" rowspan="1" class="confluenceTd"><p><code>false</code></p></td><td colspan="1" rowspan="1" class="confluenceTd"><p><strong>Camel 2.8.3/2.9:</strong> Whether the consumer should disconnect after polling. If enabled this forces Camel to connect on each poll.</p></td></tr><tr><td colspan="1" rowspan="1" class="confluenceTd"><p><code>closeFolder</code></p></td><td colspan="1" rowspan="1" class="confluenceTd"><p><code>true</code></p></td><td colspan="1" rowspan="1" class="confluenceTd"><p><strong>Camel 2.10.4:</strong> Whether the consumer should close the folder after polling. Setting this option to <code>false</code> and having <code>disconnect=false</code> as well, then the consumer keep the folder open between polls.</p></td></
 tr><tr><td colspan="1" rowspan="1" class="confluenceTd"><p><code>mail.XXX</code></p></td><td colspan="1" rowspan="1" class="confluenceTd"><p><code>null</code></p></td><td colspan="1" rowspan="1" class="confluenceTd"><p>Set any <a shape="rect" class="external-link" href="http://java.sun.com/products/javamail/javadocs/index.html" rel="nofollow">additional java mail properties</a>. For instance if you want to set a special property when using POP3 you can now provide the option directly in the URI such as: <code>mail.pop3.forgettopheaders=true</code>. You can set multiple such options, for example: <code>mail.pop3.forgettopheaders=true&amp;mail.mime.encodefilename=true</code>.</p></td></tr><tr><td colspan="1" rowspan="1" class="confluenceTd"><p><code>mapMailMessage</code></p></td><td colspan="1" rowspan="1" class="confluenceTd"><p><code>true</code></p></td><td colspan="1" rowspan="1" class="confluenceTd"><p><strong>Camel 2.8:</strong> Specifies whether Camel should map the received mai
 l message to Camel body/headers. If set to true, the body of the mail message is mapped to the body of the Camel IN message and the mail headers are mapped to IN headers. If this option is set to false then the IN message contains a raw <code>javax.mail.Message</code>. You can retrieve this raw message by calling <code>exchange.getIn().getBody(javax.mail.Message.class)</code>.</p></td></tr><tr><td colspan="1" rowspan="1" class="confluenceTd"><p><code>maxMessagesPerPoll</code></p></td><td colspan="1" rowspan="1" class="confluenceTd"><p><code>0</code></p></td><td colspan="1" rowspan="1" class="confluenceTd"><p>Specifies the maximum number of messages to gather per poll. By default, no maximum is set. Can be used to set a limit of e.g. 1000 to avoid downloading thousands of files when the server starts up. Set a value of 0 or negative to disable this option.</p></td></tr><tr><td colspan="1" rowspan="1" class="confluenceTd"><p><code>javaMailSender</code></p></td><td colspan="1" rowspan=
 "1" class="confluenceTd"><p><code>null</code></p></td><td colspan="1" rowspan="1" class="confluenceTd"><p>Specifies a pluggable <span style="color: rgb(34,34,34);">org.apache.camel.component.</span><span style="color: rgb(34,34,34);">mail.JavaMailSender</span> instance in order to use a custom email implementation.</p></td></tr><tr><td colspan="1" rowspan="1" class="confluenceTd"><p><code>ignoreUnsupportedCharset</code></p></td><td colspan="1" rowspan="1" class="confluenceTd"><p><code>false</code></p></td><td colspan="1" rowspan="1" class="confluenceTd"><p>Option to let Camel ignore unsupported charset in the local JVM when sending mails. If the charset is unsupported then <code>charset=XXX</code> (where <code>XXX</code> represents the unsupported charset) is removed from the <code>content-type</code> and it relies on the platform default instead.</p></td></tr><tr><td colspan="1" rowspan="1" class="confluenceTd"><p><code>sslContextParameters</code></p></td><td colspan="1" rowspan="1
 " class="confluenceTd"><p><code>null</code></p></td><td colspan="1" rowspan="1" class="confluenceTd"><p><strong>Camel 2.10:</strong> Reference to a <code>org.apache.camel.util.jsse.SSLContextParameters</code> in the <a shape="rect" class="external-link" href="http://camel.apache.org/registry.html">Registry</a>.&#160; This reference overrides any configured SSLContextParameters at the component level.&#160; See <a shape="rect" class="external-link" href="http://camel.apache.org/http4.html#HTTP4-UsingtheJSSEConfigurationUtility">Using the JSSE Configuration Utility</a>.</p></td></tr><tr><td colspan="1" rowspan="1" class="confluenceTd"><p><code>searchTerm</code></p></td><td colspan="1" rowspan="1" class="confluenceTd"><p><code>null</code></p></td><td colspan="1" rowspan="1" class="confluenceTd"><p><strong>Camel 2.11:</strong> Refers to a <code>javax.mail.search.SearchTerm</code> which allows to filter mails based on search criteria such as subject, body, from, sent after a certain date
  etc. See further below for examples.</p></td></tr><tr><td colspan="1" rowspan="1" class="confluenceTd"><p><code>searchTerm.xxx</code></p></td><td colspan="1" rowspan="1" class="confluenceTd"><p><code>null</code></p></td><td colspan="1" rowspan="1" class="confluenceTd"><p><strong>Camel 2.11:</strong> To configure search terms directly from the endpoint uri, which supports a limited number of terms defined by the <code>org.apache.camel.component.mail.SimpleSearchTerm</code> class. See further below for examples.</p></td></tr><tr><td colspan="1" rowspan="1" class="confluenceTd"><p class="p1"><code>sortTerm</code></p></td><td colspan="1" rowspan="1" class="confluenceTd"><code>null</code></td><td colspan="1" rowspan="1" class="confluenceTd"><strong>Camel 2.15: </strong>To configure the sortTerms that <span>IMAP</span> supports to sort the searched mails<strong><strong>. </strong></strong>You may need to define an array of<p class="p1"><code>com.sun.mail.imap.sortTerm</code> i<span>n the
  registry first and #name to reference it in this URI option.</span></p><p class="p1"><strong>Camel 2.16:</strong> You can also specify a comma separated list of sort terms on the URI that Camel will convert internally. For example, to sort descending by date you would use <code>sortTerm=reverse,date</code>. You can use any of the sort terms defined in <a shape="rect" class="external-link" href="https://javamail.java.net/nonav/docs/api/com/sun/mail/imap/SortTerm.html" rel="nofollow">com.sun.mail.imap.SortTerm</a>.</p></td></tr><tr><td colspan="1" rowspan="1" class="confluenceTd"><p class="p1"><code>postProcessAction</code></p></td><td colspan="1" rowspan="1" class="confluenceTd"><code>null</code></td><td colspan="1" rowspan="1" class="confluenceTd"><strong>Camel 2.15:</strong> Refers to a<code style="line-height: 1.4285715;">org.apache.camel.component.mail.</code><span style="line-height: 1.4285715;"><code>MailBoxPostProcessAction</code> for doing post processing tasks on the mailbo
 x once the normal processing ended.</span></td></tr><tr><td colspan="1" rowspan="1" class="confluenceTd"><code>skipFailedMessage</code></td><td colspan="1" rowspan="1" class="confluenceTd"><code>false</code></td><td colspan="1" rowspan="1" class="confluenceTd"><strong>Camel 2.15.1:</strong> If the mail consumer cannot retrieve a given mail message, then this option allows to skip the message and move on to retrieve the next mail message. The default behavior would be the consumer throws an exception and no mails from the batch would be able to be routed by Camel.</td></tr><tr><td colspan="1" rowspan="1" class="confluenceTd"><code>handleFailedMessage</code></td><td colspan="1" rowspan="1" class="confluenceTd"><code>false</code></td><td colspan="1" rowspan="1" class="confluenceTd"><strong>Camel 2.15.1:</strong> If the mail consumer cannot retrieve a given mail message, then this option allows to handle the caused exception by the consumer's error handler. By enable the bridge error ha
 ndler on the consumer, then the Camel routing error handler can handle the exception instead. <span>The default behavior would be the consumer throws an exception and no mails from the batch would be able to be routed by Camel.</span></td></tr><tr><td colspan="1" rowspan="1" class="confluenceTd"><pre><span>dummyTrustManager</span></pre></td><td colspan="1" rowspan="1" class="confluenceTd"><code>false</code></td><td colspan="1" rowspan="1" class="confluenceTd"><strong>Camel 2.17:</strong>To use a dummy security setting for trusting all certificates. Should only be used for development mode, and not production.</td></tr><tr><td colspan="1" rowspan="1" class="confluenceTd"><code>idempotentRepository</code></td><td colspan="1" rowspan="1" class="confluenceTd"><code>null</code></td><td colspan="1" rowspan="1" class="confluenceTd"><strong>Camel 2.17:</strong> A pluggable repository org.apache.camel.spi.IdempotentRepository which allows to cluster consuming from the same mailbox, and let t
 he repository coordinate whether a mail message is valid for the consumer to process.</td></tr><tr><td colspan="1" rowspan="1" class="confluenceTd"><code>idempotentRepositoryRemoveOnCommit</code></td><td colspan="1" rowspan="1" class="confluenceTd"><code>true</code></td><td colspan="1" rowspan="1" class="confluenceTd"><strong>Camel 2.17:</strong> <span style="line-height: 1.42857;">When using idempotent repository, then when the mail message has been successfully processed and is committed, should the message id be removed from the idempotent repository (default) or be kept in the repository. By default its assumed the message id is unique and has no value to be kept in the repository, because the mail message will be marked as seen/moved or deleted to prevent it from being consumed again. And therefore having the message id stored in the idempotent repository has little value. However this option allows to store the message id, for whatever reason you may have.</span></td></tr><tr>
 <td colspan="1" rowspan="1" class="confluenceTd"><code>mailUidGenerator</code></td><td colspan="1" rowspan="1" class="confluenceTd">&#160;</td><td colspan="1" rowspan="1" class="confluenceTd"><strong>Camel 2.17:</strong> A pluggable MailUidGenerator that allows to use custom logic to generate UUID of the mail message.</td></tr></tbody></table></div></rich-text-body><h3 id="Mail-SSLsupport">SSL support</h3><p>The underlying mail framework is responsible for providing SSL support. &#160;You may either configure SSL/TLS support by completely specifying the necessary Java Mail API configuration options, or you may provide a configured SSLContextParameters through the component or endpoint configuration.</p><h4 id="Mail-UsingtheJSSEConfigurationUtility">Using the JSSE Configuration Utility</h4><p>As of <strong>Camel 2.10</strong>, the mail component supports SSL/TLS configuration through the <a shape="rect" href="camel-configuration-utilities.html">Camel JSSE Configuration Utility</a>.&#
 160; This utility greatly decreases the amount of component specific code you need to write and is configurable at the endpoint and component levels.&#160; The following examples demonstrate how to use the utility with the mail component.</p><h5 id="Mail-Programmaticconfigurationoftheendpoint">Programmatic configuration of the endpoint</h5><plain-text-body>KeyStoreParameters ksp = new KeyStoreParameters();
+ksp.setResource("/users/home/server/truststore.jks");
+ksp.setPassword("keystorePassword");
 TrustManagersParameters tmp = new TrustManagersParameters();
 tmp.setKeyStore(ksp);
 SSLContextParameters scp = new SSLContextParameters();
 scp.setTrustManagers(tmp);
 Registry registry = ...
-registry.bind(&quot;sslContextParameters&quot;, scp);
+registry.bind("sslContextParameters", scp);
 ...
 from(...)
-&amp;nbsp; &amp;nbsp; .to(&quot;smtps://smtp.google.com?username=user@gmail.com&amp;password=password&amp;sslContextParameters=#sslContextParameters&quot;);
-]]></script>
-</div></div><h5 id="Mail-SpringDSLbasedconfigurationofendpoint">Spring DSL based configuration of endpoint</h5><div class="code panel pdl" style="border-width: 1px;"><div class="codeContent panelContent pdl">
-<script class="brush: xml; gutter: false; theme: Default" type="syntaxhighlighter"><![CDATA[...
-&lt;camel:sslContextParameters id=&quot;sslContextParameters&quot;&gt;
+&amp;nbsp; &amp;nbsp; .to("smtps://smtp.google.com?username=user@gmail.com&amp;password=password&amp;sslContextParameters=#sslContextParameters");
+</plain-text-body><h5 id="Mail-SpringDSLbasedconfigurationofendpoint">Spring DSL based configuration of endpoint</h5><parameter ac:name="">xml</parameter><plain-text-body>...
+&lt;camel:sslContextParameters id="sslContextParameters"&gt;
   &lt;camel:trustManagers&gt;
-    &lt;camel:keyStore resource=&quot;/users/home/server/truststore.jks&quot; password=&quot;keystorePassword&quot;/&gt;
+    &lt;camel:keyStore resource="/users/home/server/truststore.jks" password="keystorePassword"/&gt;
   &lt;/camel:trustManagers&gt;
 &lt;/camel:sslContextParameters&gt;...
 ...
-&lt;to uri=&quot;smtps://smtp.google.com?username=user@gmail.com&amp;password=password&amp;sslContextParameters=#sslContextParameters&quot;/&gt;...
-]]></script>
-</div></div><h4 id="Mail-ConfiguringJavaMailDirectly">Configuring JavaMail Directly</h4><p>Camel uses SUN JavaMail, which only trusts certificates issued by well known Certificate Authorities (the default JVM trust configuration). If you issue your own certificates, you have to import the CA certificates into the JVM's Java trust/key store files, override the default JVM trust/key store files (see <code>SSLNOTES.txt</code> in JavaMail for details).</p><h3 id="Mail-MailMessageContent">Mail Message Content</h3><p>Camel uses the message exchange's IN body as the <a shape="rect" class="external-link" href="http://java.sun.com/javaee/5/docs/api/javax/mail/internet/MimeMessage.html" rel="nofollow">MimeMessage</a> text content. The body is converted to <code>String.class</code>.</p><p>Camel copies all of the exchange's IN headers to the <a shape="rect" class="external-link" href="http://java.sun.com/javaee/5/docs/api/javax/mail/internet/MimeMessage.html" rel="nofollow">MimeMessage</a> head
 ers.&#160;You may wish to read&#160;<a shape="rect" href="how-to-avoid-sending-some-or-all-message-headers.html">How to avoid sending some or all message headers</a> to prevent inadvertent data "leaks" from your application.</p><p>The subject of the <a shape="rect" class="external-link" href="http://java.sun.com/javaee/5/docs/api/javax/mail/internet/MimeMessage.html" rel="nofollow">MimeMessage</a> can be configured using a header property on the IN message. The code below demonstrates this:</p><div class="code panel pdl" style="border-width: 1px;"><div class="codeContent panelContent pdl">
-<script class="brush: java; gutter: false; theme: Default" type="syntaxhighlighter"><![CDATA[
-from(&quot;direct:a&quot;).setHeader(&quot;subject&quot;, constant(subject)).to(&quot;smtp://james2@localhost&quot;);
-]]></script>
-</div></div>The same applies for other MimeMessage headers such as recipients, so you can use a header property as <code>To</code>:<div class="code panel pdl" style="border-width: 1px;"><div class="codeContent panelContent pdl">
-<script class="brush: java; gutter: false; theme: Default" type="syntaxhighlighter"><![CDATA[
-Map&lt;String, Object&gt; map = new HashMap&lt;String, Object&gt;();
-map.put(&quot;To&quot;, &quot;davsclaus@apache.org&quot;);
-map.put(&quot;From&quot;, &quot;jstrachan@apache.org&quot;);
-map.put(&quot;Subject&quot;, &quot;Camel rocks&quot;);
-map.put(&quot;CamelFileName&quot;, &quot;fileOne&quot;);
-map.put(&quot;org.apache.camel.test&quot;, &quot;value&quot;);
-
-String body = &quot;Hello Claus.\nYes it does.\n\nRegards James.&quot;;
-template.sendBodyAndHeaders(&quot;smtp://davsclaus@apache.org&quot;, body, map);
-]]></script>
-</div></div><strong>Since Camel 2.11</strong> When using the MailProducer the send the mail to server, you should be able to get the message id of the <a shape="rect" class="external-link" href="http://java.sun.com/javaee/5/docs/api/javax/mail/internet/MimeMessage.html" rel="nofollow">MimeMessage</a> with the key <code>CamelMailMessageId</code> from the Camel message header.<h3 id="Mail-Headerstakeprecedenceoverpre-configuredrecipients">Headers take precedence over pre-configured recipients</h3><p>The recipients specified in the message headers always take precedence over recipients pre-configured in the endpoint URI. The idea is that if you provide any recipients in the message headers, that is what you get. The recipients pre-configured in the endpoint URI are treated as a fallback.</p><p>In the sample code below, the email message is sent to <code>davsclaus@apache.org</code>, because it takes precedence over the pre-configured recipient, <code>info@mycompany.com</code>. Any <code
 >cc</code> and <code>bcc</code> settings in the endpoint URI are also ignored and those recipients will not receive any mail. The choice between headers and pre-configured settings is all or nothing: the mail component <em>either</em> takes the recipients exclusively from the headers or exclusively from the pre-configured settings. It is not possible to mix and match headers and pre-configured settings.</p><div class="code panel pdl" style="border-width: 1px;"><div class="codeContent panelContent pdl">
-<script class="brush: java; gutter: false; theme: Default" type="syntaxhighlighter"><![CDATA[        Map&lt;String, Object&gt; headers = new HashMap&lt;String, Object&gt;();
-        headers.put(&quot;to&quot;, &quot;davsclaus@apache.org&quot;);
-
-        template.sendBodyAndHeaders(&quot;smtp://admin@localhost?to=info@mycompany.com&quot;, &quot;Hello World&quot;, headers);
-]]></script>
-</div></div><h3 id="Mail-Multiplerecipientsforeasierconfiguration">Multiple recipients for easier configuration</h3><p>It is possible to set multiple recipients using a comma-separated or a semicolon-separated list. This applies both to header settings and to settings in an endpoint URI. For example:</p><div class="code panel pdl" style="border-width: 1px;"><div class="codeContent panelContent pdl">
-<script class="brush: java; gutter: false; theme: Default" type="syntaxhighlighter"><![CDATA[        Map&lt;String, Object&gt; headers = new HashMap&lt;String, Object&gt;();
-        headers.put(&quot;to&quot;, &quot;davsclaus@apache.org ; jstrachan@apache.org ; ningjiang@apache.org&quot;);
-]]></script>
-</div></div><p>The preceding example uses a semicolon, <code>;</code>, as the separator character.</p><h3 id="Mail-Settingsendernameandemail">Setting sender name and email</h3><p>You can specify recipients in the format, <code>name &lt;email&gt;</code>, to include both the name and the email address of the recipient.</p><p>For example, you define the following headers on the a <a shape="rect" href="message.html">Message</a>:</p><div class="code panel pdl" style="border-width: 1px;"><div class="codeContent panelContent pdl">
-<script class="brush: java; gutter: false; theme: Default" type="syntaxhighlighter"><![CDATA[Map headers = new HashMap();
-map.put(&quot;To&quot;, &quot;Claus Ibsen &lt;davsclaus@apache.org&gt;&quot;);
-map.put(&quot;From&quot;, &quot;James Strachan &lt;jstrachan@apache.org&gt;&quot;);
-map.put(&quot;Subject&quot;, &quot;Camel is cool&quot;);
-]]></script>
-</div></div><h3 id="Mail-JavaMailAPI(exSUNJavaMail)">JavaMail API (ex SUN JavaMail)</h3><p><a shape="rect" class="external-link" href="https://java.net/projects/javamail/pages/Home" rel="nofollow">JavaMail API</a> is used under the hood for consuming and producing mails.<br clear="none"> We encourage end-users to consult these references when using either POP3 or IMAP protocol. Note particularly that POP3 has a much more limited set of features than IMAP.</p><ul class="alternate"><li><a shape="rect" class="external-link" href="https://javamail.java.net/nonav/docs/api/com/sun/mail/pop3/package-summary.html" rel="nofollow">JavaMail POP3 API</a></li><li><a shape="rect" class="external-link" href="https://javamail.java.net/nonav/docs/api/com/sun/mail/imap/package-summary.html" rel="nofollow">JavaMail IMAP API</a></li><li>And generally about the <a shape="rect" class="external-link" href="https://javamail.java.net/nonav/docs/api/javax/mail/Flags.html" rel="nofollow">MAIL Flags</a></li></
 ul><h3 id="Mail-Samples">Samples</h3><p>We start with a simple route that sends the messages received from a JMS queue as emails. The email account is the <code>admin</code> account on <code>mymailserver.com</code>.</p><div class="code panel pdl" style="border-width: 1px;"><div class="codeContent panelContent pdl">
-<script class="brush: java; gutter: false; theme: Default" type="syntaxhighlighter"><![CDATA[from(&quot;jms://queue:subscription&quot;).to(&quot;smtp://admin@mymailserver.com?password=secret&quot;);
-]]></script>
-</div></div><p>In the next sample, we poll a mailbox for new emails once every minute. Notice that we use the special <code>consumer</code> option for setting the poll interval, <code>consumer.delay</code>, as 60000 milliseconds = 60 seconds.</p><div class="code panel pdl" style="border-width: 1px;"><div class="codeContent panelContent pdl">
-<script class="brush: java; gutter: false; theme: Default" type="syntaxhighlighter"><![CDATA[from(&quot;imap://admin@mymailserver.com
-     password=secret&amp;unseen=true&amp;consumer.delay=60000&quot;)
-    .to(&quot;seda://mails&quot;);
-]]></script>
-</div></div><p>In this sample we want to send a mail to multiple recipients:</p><div class="code panel pdl" style="border-width: 1px;"><div class="codeContent panelContent pdl">
-<script class="brush: java; gutter: false; theme: Default" type="syntaxhighlighter"><![CDATA[
-// all the recipients of this mail are:
-// to: camel@riders.org , easy@riders.org
-// cc: me@you.org
-// bcc: someone@somewhere.org
-String recipients = &quot;&amp;to=camel@riders.org,easy@riders.org&amp;cc=me@you.org&amp;bcc=someone@somewhere.org&quot;;
-
-from(&quot;direct:a&quot;).to(&quot;smtp://you@mymailserver.com?password=secret&amp;from=you@apache.org&quot; + recipients);
-]]></script>
-</div></div><h3 id="Mail-Sendingmailwithattachmentsample">Sending mail with attachment sample</h3><div class="confluence-information-macro confluence-information-macro-warning"><p class="title">Attachments are not support by all Camel components</p><span class="aui-icon aui-icon-small aui-iconfont-error confluence-information-macro-icon"></span><div class="confluence-information-macro-body"><p>The <em>Attachments API</em> is based on the Java Activation Framework and is generally only used by the Mail API. Since many of the other Camel components do not support attachments, the attachments could potentially be lost as they propagate along the route. The rule of thumb, therefore, is to add attachments just before sending a message to the mail endpoint.</p></div></div><p>The mail component supports attachments. In the sample below, we send a mail message containing a plain text message with a logo file attachment.</p><div class="code panel pdl" style="border-width: 1px;"><div class="c
 odeContent panelContent pdl">
-<script class="brush: java; gutter: false; theme: Default" type="syntaxhighlighter"><![CDATA[
-
-// create an exchange with a normal body and attachment to be produced as email
-Endpoint endpoint = context.getEndpoint(&quot;smtp://james@mymailserver.com?password=secret&quot;);
-
-// create the exchange with the mail message that is multipart with a file and a Hello World text/plain message.
-Exchange exchange = endpoint.createExchange();
-Message in = exchange.getIn();
-in.setBody(&quot;Hello World&quot;);
-DefaultAttachment att = new DefaultAttachment(new FileDataSource(&quot;src/test/data/logo.jpeg&quot;));
-att.addHeader(&quot;Content-Description&quot;, &quot;some sample content&quot;);
-in.addAttachmentObject(&quot;logo.jpeg&quot;, att);
-
-// create a producer that can produce the exchange (= send the mail)
-Producer producer = endpoint.createProducer();
-// start the producer
-producer.start();
-// and let it go (processes the exchange by sending the email)
-producer.process(exchange);
-
-]]></script>
-</div></div><h3 id="Mail-SSLsample">SSL sample</h3><p>In this sample, we want to poll our Google mail inbox for mails. To download mail onto a local mail client, Google mail requires you to enable and configure SSL. This is done by logging into your Google mail account and changing your settings to allow IMAP access. Google have extensive documentation on how to do this.</p><div class="code panel pdl" style="border-width: 1px;"><div class="codeContent panelContent pdl">
-<script class="brush: java; gutter: false; theme: Default" type="syntaxhighlighter"><![CDATA[from(&quot;imaps://imap.gmail.com?username=YOUR_USERNAME@gmail.com&amp;password=YOUR_PASSWORD&quot;
-    + &quot;&amp;delete=false&amp;unseen=true&amp;consumer.delay=60000&quot;).to(&quot;log:newmail&quot;);
-]]></script>
-</div></div><p>The preceding route polls the Google mail inbox for new mails once every minute and logs the received messages to the <code>newmail</code> logger category.<br clear="none"> Running the sample with <code>DEBUG</code> logging enabled, we can monitor the progress in the logs:</p><div class="code panel pdl" style="border-width: 1px;"><div class="codeContent panelContent pdl">
-<script class="brush: java; gutter: false; theme: Default" type="syntaxhighlighter"><![CDATA[2008-05-08 06:32:09,640 DEBUG MailConsumer - Connecting to MailStore imaps//imap.gmail.com:993 (SSL enabled), folder=INBOX
+&lt;to uri="smtps://smtp.google.com?username=user@gmail.com&amp;password=password&amp;sslContextParameters=#sslContextParameters"/&gt;...
+</plain-text-body><h4 id="Mail-ConfiguringJavaMailDirectly">Configuring JavaMail Directly</h4><p>Camel uses SUN JavaMail, which only trusts certificates issued by well known Certificate Authorities (the default JVM trust configuration). If you issue your own certificates, you have to import the CA certificates into the JVM's Java trust/key store files, override the default JVM trust/key store files (see <code>SSLNOTES.txt</code> in JavaMail for details).</p><h3 id="Mail-MailMessageContent">Mail Message Content</h3><p>Camel uses the message exchange's IN body as the <a shape="rect" class="external-link" href="http://java.sun.com/javaee/5/docs/api/javax/mail/internet/MimeMessage.html" rel="nofollow">MimeMessage</a> text content. The body is converted to <code>String.class</code>.</p><p>Camel copies all of the exchange's IN headers to the <a shape="rect" class="external-link" href="http://java.sun.com/javaee/5/docs/api/javax/mail/internet/MimeMessage.html" rel="nofollow">MimeMessage</a
 > headers.&#160;You may wish to read&#160;<a shape="rect" href="how-to-avoid-sending-some-or-all-message-headers.html">How to avoid sending some or all message headers</a> to prevent inadvertent data "leaks" from your application.</p><p>The subject of the <a shape="rect" class="external-link" href="http://java.sun.com/javaee/5/docs/api/javax/mail/internet/MimeMessage.html" rel="nofollow">MimeMessage</a> can be configured using a header property on the IN message. The code below demonstrates this:<plain-text-body>{snippet:id=e1|lang=java|url=camel/trunk/components/camel-mail/src/test/java/org/apache/camel/component/mail/MailSubjectTest.java}</plain-text-body>The same applies for other MimeMessage headers such as recipients, so you can use a header property as <code>To</code>:<plain-text-body>{snippet:id=e1|lang=java|url=camel/trunk/components/camel-mail/src/test/java/org/apache/camel/component/mail/MailUsingHeadersTest.java}</plain-text-body><strong>Since Camel 2.11</strong> When usi
 ng the MailProducer the send the mail to server, you should be able to get the message id of the <a shape="rect" class="external-link" href="http://java.sun.com/javaee/5/docs/api/javax/mail/internet/MimeMessage.html" rel="nofollow">MimeMessage</a> with the key <code>CamelMailMessageId</code> from the Camel message header.</p><h3 id="Mail-Headerstakeprecedenceoverpre-configuredrecipients">Headers take precedence over pre-configured recipients</h3><p>The recipients specified in the message headers always take precedence over recipients pre-configured in the endpoint URI. The idea is that if you provide any recipients in the message headers, that is what you get. The recipients pre-configured in the endpoint URI are treated as a fallback.</p><p>In the sample code below, the email message is sent to <code>davsclaus@apache.org</code>, because it takes precedence over the pre-configured recipient, <code>info@mycompany.com</code>. Any <code>cc</code> and <code>bcc</code> settings in the en
 dpoint URI are also ignored and those recipients will not receive any mail. The choice between headers and pre-configured settings is all or nothing: the mail component <em>either</em> takes the recipients exclusively from the headers or exclusively from the pre-configured settings. It is not possible to mix and match headers and pre-configured settings.</p><parameter ac:name="">java</parameter><plain-text-body>        Map&lt;String, Object&gt; headers = new HashMap&lt;String, Object&gt;();
+        headers.put("to", "davsclaus@apache.org");
+
+        template.sendBodyAndHeaders("smtp://admin@localhost?to=info@mycompany.com", "Hello World", headers);
+</plain-text-body><h3 id="Mail-Multiplerecipientsforeasierconfiguration">Multiple recipients for easier configuration</h3><p>It is possible to set multiple recipients using a comma-separated or a semicolon-separated list. This applies both to header settings and to settings in an endpoint URI. For example:</p><parameter ac:name="">java</parameter><plain-text-body>        Map&lt;String, Object&gt; headers = new HashMap&lt;String, Object&gt;();
+        headers.put("to", "davsclaus@apache.org ; jstrachan@apache.org ; ningjiang@apache.org");
+</plain-text-body><p>The preceding example uses a semicolon, <code>;</code>, as the separator character.</p><h3 id="Mail-Settingsendernameandemail">Setting sender name and email</h3><p>You can specify recipients in the format, <code>name &lt;email&gt;</code>, to include both the name and the email address of the recipient.</p><p>For example, you define the following headers on the a <a shape="rect" href="message.html">Message</a>:</p><plain-text-body>Map headers = new HashMap();
+map.put("To", "Claus Ibsen &lt;davsclaus@apache.org&gt;");
+map.put("From", "James Strachan &lt;jstrachan@apache.org&gt;");
+map.put("Subject", "Camel is cool");
+</plain-text-body><h3 id="Mail-JavaMailAPI(exSUNJavaMail)">JavaMail API (ex SUN JavaMail)</h3><p><a shape="rect" class="external-link" href="https://java.net/projects/javamail/pages/Home" rel="nofollow">JavaMail API</a> is used under the hood for consuming and producing mails.<br clear="none"> We encourage end-users to consult these references when using either POP3 or IMAP protocol. Note particularly that POP3 has a much more limited set of features than IMAP.</p><ul class="alternate"><li><a shape="rect" class="external-link" href="https://javamail.java.net/nonav/docs/api/com/sun/mail/pop3/package-summary.html" rel="nofollow">JavaMail POP3 API</a></li><li><a shape="rect" class="external-link" href="https://javamail.java.net/nonav/docs/api/com/sun/mail/imap/package-summary.html" rel="nofollow">JavaMail IMAP API</a></li><li>And generally about the <a shape="rect" class="external-link" href="https://javamail.java.net/nonav/docs/api/javax/mail/Flags.html" rel="nofollow">MAIL Flags</a><
 /li></ul><h3 id="Mail-Samples">Samples</h3><p>We start with a simple route that sends the messages received from a JMS queue as emails. The email account is the <code>admin</code> account on <code>mymailserver.com</code>.</p><plain-text-body>from("jms://queue:subscription").to("smtp://admin@mymailserver.com?password=secret");
+</plain-text-body><p>In the next sample, we poll a mailbox for new emails once every minute. Notice that we use the special <code>consumer</code> option for setting the poll interval, <code>consumer.delay</code>, as 60000 milliseconds = 60 seconds.</p><plain-text-body>from("imap://admin@mymailserver.com
+     password=secret&amp;unseen=true&amp;consumer.delay=60000")
+    .to("seda://mails");
+</plain-text-body><p>In this sample we want to send a mail to multiple recipients:<plain-text-body>{snippet:id=e1|lang=java|url=camel/trunk/components/camel-mail/src/test/java/org/apache/camel/component/mail/MailRecipientsTest.java}</plain-text-body></p><h3 id="Mail-Sendingmailwithattachmentsample">Sending mail with attachment sample</h3><parameter ac:name="title">Attachments are not support by all Camel components</parameter><rich-text-body><p>The <em>Attachments API</em> is based on the Java Activation Framework and is generally only used by the Mail API. Since many of the other Camel components do not support attachments, the attachments could potentially be lost as they propagate along the route. The rule of thumb, therefore, is to add attachments just before sending a message to the mail endpoint.</p></rich-text-body><p>The mail component supports attachments. In the sample below, we send a mail message containing a plain text message with a logo file attachment.<plain-text-bod
 y>{snippet:id=e1|lang=java|url=camel/trunk/components/camel-mail/src/test/java/org/apache/camel/component/mail/MailAttachmentTest.java}</plain-text-body></p><h3 id="Mail-SSLsample">SSL sample</h3><p>In this sample, we want to poll our Google mail inbox for mails. To download mail onto a local mail client, Google mail requires you to enable and configure SSL. This is done by logging into your Google mail account and changing your settings to allow IMAP access. Google have extensive documentation on how to do this.</p><plain-text-body>from("imaps://imap.gmail.com?username=YOUR_USERNAME@gmail.com&amp;password=YOUR_PASSWORD"
+    + "&amp;delete=false&amp;unseen=true&amp;consumer.delay=60000").to("log:newmail");
+</plain-text-body><p>The preceding route polls the Google mail inbox for new mails once every minute and logs the received messages to the <code>newmail</code> logger category.<br clear="none"> Running the sample with <code>DEBUG</code> logging enabled, we can monitor the progress in the logs:</p><plain-text-body>2008-05-08 06:32:09,640 DEBUG MailConsumer - Connecting to MailStore imaps//imap.gmail.com:993 (SSL enabled), folder=INBOX
 2008-05-08 06:32:11,203 DEBUG MailConsumer - Polling mailfolder: imaps//imap.gmail.com:993 (SSL enabled), folder=INBOX
 2008-05-08 06:32:11,640 DEBUG MailConsumer - Fetching 1 messages. Total 1 messages.
 2008-05-08 06:32:12,171 DEBUG MailConsumer - Processing message: messageNumber=[332], from=[James Bond &lt;007@mi5.co.uk&gt;], to=YOUR_USERNAME@gmail.com], subject=[...
 2008-05-08 06:32:12,187 INFO  newmail - Exchange[MailMessage: messageNumber=[332], from=[James Bond &lt;007@mi5.co.uk&gt;], to=YOUR_USERNAME@gmail.com], subject=[...
-]]></script>
-</div></div><h3 id="Mail-Consumingmailswithattachmentsample">Consuming mails with attachment sample</h3><p>In this sample we poll a mailbox and store all attachments from the mails as files. First, we define a route to poll the mailbox. As this sample is based on google mail, it uses the same route as shown in the SSL sample:</p><div class="code panel pdl" style="border-width: 1px;"><div class="codeContent panelContent pdl">
-<script class="brush: java; gutter: false; theme: Default" type="syntaxhighlighter"><![CDATA[from(&quot;imaps://imap.gmail.com?username=YOUR_USERNAME@gmail.com&amp;password=YOUR_PASSWORD&quot;
-    + &quot;&amp;delete=false&amp;unseen=true&amp;consumer.delay=60000&quot;).process(new MyMailProcessor());
-]]></script>
-</div></div><p>Instead of logging the mail we use a processor where we can process the mail from java code:</p><div class="code panel pdl" style="border-width: 1px;"><div class="codeContent panelContent pdl">
-<script class="brush: java; gutter: false; theme: Default" type="syntaxhighlighter"><![CDATA[    public void process(Exchange exchange) throws Exception {
+</plain-text-body><h3 id="Mail-Consumingmailswithattachmentsample">Consuming mails with attachment sample</h3><p>In this sample we poll a mailbox and store all attachments from the mails as files. First, we define a route to poll the mailbox. As this sample is based on google mail, it uses the same route as shown in the SSL sample:</p><plain-text-body>from("imaps://imap.gmail.com?username=YOUR_USERNAME@gmail.com&amp;password=YOUR_PASSWORD"
+    + "&amp;delete=false&amp;unseen=true&amp;consumer.delay=60000").process(new MyMailProcessor());
+</plain-text-body><p>Instead of logging the mail we use a processor where we can process the mail from java code:</p><plain-text-body>    public void process(Exchange exchange) throws Exception {
         // the API is a bit clunky so we need to loop
         Map&lt;String, DataHandler&gt; attachments = exchange.getIn().getAttachments();
         if (attachments.size() &gt; 0) {
@@ -252,72 +154,41 @@ producer.process(exchange);
             }
         }
    }
-]]></script>
-</div></div><p>As you can see the API to handle attachments is a bit clunky but it's there so you can get the <code>javax.activation.DataHandler</code> so you can handle the attachments using standard API.</p><h3 id="Mail-Howtosplitamailmessagewithattachments">How to split a mail message with attachments</h3><p>In this example we consume mail messages which may have a number of attachments. What we want to do is to use the <a shape="rect" href="splitter.html">Splitter</a> EIP per individual attachment, to process the attachments separately. For example if the mail message has 5 attachments, we want the <a shape="rect" href="splitter.html">Splitter</a> to process five messages, each having a single attachment. To do this we need to provide a custom <a shape="rect" href="expression.html">Expression</a> to the <a shape="rect" href="splitter.html">Splitter</a> where we provide a List&lt;Message&gt; that contains the five messages with the single attachment.</p><p>The code is provided ou
 t of the box in Camel 2.10 onwards in the <code>camel-mail</code> component. The code is in the class: <code>org.apache.camel.component.mail.SplitAttachmentsExpression</code>, which you can find the source code <a shape="rect" class="external-link" href="https://svn.apache.org/repos/asf/camel/trunk/components/camel-mail/src/main/java/org/apache/camel/component/mail/SplitAttachmentsExpression.java">here</a></p><p>In the Camel route you then need to use this <a shape="rect" href="expression.html">Expression</a> in the route as shown below:</p><div class="code panel pdl" style="border-width: 1px;"><div class="codeContent panelContent pdl">
-<script class="brush: java; gutter: false; theme: Default" type="syntaxhighlighter"><![CDATA[
-from(&quot;pop3://james@mymailserver.com?password=secret&amp;consumer.delay=1000&quot;)
-    .to(&quot;log:email&quot;)
-    // use the SplitAttachmentsExpression which will split the message per attachment
-    .split(splitAttachmentsExpression)
-        // each message going to this mock has a single attachment
-        .to(&quot;mock:split&quot;)
-    .end();
-]]></script>
-</div></div>If you use XML DSL then you need to declare a method call expression in the <a shape="rect" href="splitter.html">Splitter</a> as shown below<div class="code panel pdl" style="border-width: 1px;"><div class="codeContent panelContent pdl">
-<script class="brush: xml; gutter: false; theme: Default" type="syntaxhighlighter"><![CDATA[&lt;split&gt;
-  &lt;method beanType=&quot;org.apache.camel.component.mail.SplitAttachmentsExpression&quot;/&gt;
-  &lt;to uri=&quot;mock:split&quot;/&gt;
+</plain-text-body><p>As you can see the API to handle attachments is a bit clunky but it's there so you can get the <code>javax.activation.DataHandler</code> so you can handle the attachments using standard API.</p><h3 id="Mail-Howtosplitamailmessagewithattachments">How to split a mail message with attachments</h3><p>In this example we consume mail messages which may have a number of attachments. What we want to do is to use the <a shape="rect" href="splitter.html">Splitter</a> EIP per individual attachment, to process the attachments separately. For example if the mail message has 5 attachments, we want the <a shape="rect" href="splitter.html">Splitter</a> to process five messages, each having a single attachment. To do this we need to provide a custom <a shape="rect" href="expression.html">Expression</a> to the <a shape="rect" href="splitter.html">Splitter</a> where we provide a List&lt;Message&gt; that contains the five messages with the single attachment.</p><p>The code is provi
 ded out of the box in Camel 2.10 onwards in the <code>camel-mail</code> component. The code is in the class: <code>org.apache.camel.component.mail.SplitAttachmentsExpression</code>, which you can find the source code <a shape="rect" class="external-link" href="https://svn.apache.org/repos/asf/camel/trunk/components/camel-mail/src/main/java/org/apache/camel/component/mail/SplitAttachmentsExpression.java">here</a></p><p>In the Camel route you then need to use this <a shape="rect" href="expression.html">Expression</a> in the route as shown below:<plain-text-body>{snippet:id=e1|lang=java|url=camel/trunk/components/camel-mail/src/test/java/org/apache/camel/component/mail/MailSplitAttachmentsTest.java}</plain-text-body>If you use XML DSL then you need to declare a method call expression in the <a shape="rect" href="splitter.html">Splitter</a> as shown below</p><parameter ac:name="">xml</parameter><plain-text-body>&lt;split&gt;
+  &lt;method beanType="org.apache.camel.component.mail.SplitAttachmentsExpression"/&gt;
+  &lt;to uri="mock:split"/&gt;
 &lt;/split&gt;
-]]></script>
-</div></div><p>&#160;</p><p>From Camel 2.16 onwards you can also split the attachments as byte[] to be stored as the message body. This is done by creating the expression with boolean true</p><div class="code panel pdl" style="border-width: 1px;"><div class="codeContent panelContent pdl">
-<script class="brush: java; gutter: false; theme: Default" type="syntaxhighlighter"><![CDATA[SplitAttachmentsExpression split = SplitAttachmentsExpression(true);]]></script>
-</div></div><p>And then use the expression with the splitter eip.</p><h3 id="Mail-UsingcustomSearchTerm">Using custom SearchTerm</h3><p><strong>Available as of Camel 2.11</strong></p><p>You can configure a <code>searchTerm</code> on the <code>MailEndpoint</code> which allows you to filter out unwanted mails.</p><p>For example to filter mails to contain Camel in either Subject or Text you can do as follows:</p><div class="code panel pdl" style="border-width: 1px;"><div class="codeContent panelContent pdl">
-<script class="brush: xml; gutter: false; theme: Default" type="syntaxhighlighter"><![CDATA[&lt;route&gt;
-  &lt;from uri=&quot;imaps://mymailseerver?username=foo&amp;password=secret&amp;searchTerm.subjectOrBody=Camel&quot;/&gt;
-  &lt;to uri=&quot;bean:myBean&quot;/&gt;
+</plain-text-body><p>&#160;</p><p>From Camel 2.16 onwards you can also split the attachments as byte[] to be stored as the message body. This is done by creating the expression with boolean true</p><plain-text-body>SplitAttachmentsExpression split = SplitAttachmentsExpression(true);</plain-text-body><p>And then use the expression with the splitter eip.</p><h3 id="Mail-UsingcustomSearchTerm">Using custom SearchTerm</h3><p><strong>Available as of Camel 2.11</strong></p><p>You can configure a <code>searchTerm</code> on the <code>MailEndpoint</code> which allows you to filter out unwanted mails.</p><p>For example to filter mails to contain Camel in either Subject or Text you can do as follows:</p><parameter ac:name="">xml</parameter><plain-text-body>&lt;route&gt;
+  &lt;from uri="imaps://mymailseerver?username=foo&amp;password=secret&amp;searchTerm.subjectOrBody=Camel"/&gt;
+  &lt;to uri="bean:myBean"/&gt;
 &lt;/route&gt;
-]]></script>
-</div></div><p>Notice we use the <code>"searchTerm.subjectOrBody"</code> as parameter key to indicate that we want to search on mail subject or body, to contain the word "Camel".<br clear="none"> The class <code>org.apache.camel.component.mail.SimpleSearchTerm</code> has a number of options you can configure:</p><p>Or to get the new unseen emails going 24 hours back in time you can do. Notice the "now-24h" syntax. See the table below for more details.</p><div class="code panel pdl" style="border-width: 1px;"><div class="codeContent panelContent pdl">
-<script class="brush: xml; gutter: false; theme: Default" type="syntaxhighlighter"><![CDATA[&lt;route&gt;
-  &lt;from uri=&quot;imaps://mymailseerver?username=foo&amp;password=secret&amp;searchTerm.fromSentDate=now-24h&quot;/&gt;
-  &lt;to uri=&quot;bean:myBean&quot;/&gt;

[... 58 lines stripped ...]