title: Apache Camel smtp component hangs the whole bus if mailserver is down
body: <p>I have what I think is a very common scenario. I have an invoice system that is managed via Apache Camel. When something goes wrong I would like to have an email alert sent to the administrator.</p>
  
  <p>After reading about Camel exception handling I came up with this: (inside my Spring XML)</p>
  
  <pre><code>&lt;!-- General retrasmission policy set to 3 times --&gt;
          &lt;errorHandler id="deadChannel" type="DeadLetterChannel"
              deadLetterUri="direct:invoice-error"&gt;
              &lt;redeliveryPolicy maximumRedeliveries="2"
                  redeliveryDelay="1000" backOffMultiplier="2" useExponentialBackOff="true" /&gt;
          &lt;/errorHandler&gt;
  
          &lt;!-- Problematic invoices create email alerts to the administrator --&gt;
          &lt;route id="invoices-with-errors"&gt;
              &lt;from uri="direct:invoice-error" /&gt;
              &lt;bean ref="emailAlert" method="handleProblematicInvoice" /&gt;
              &lt;to
                  uri="smtp://{{errormail.host}}?to={{errormail.to}}&amp;amp;subject={{errormail.subject}}&amp;amp;from={{errormail.from}};debugMode=true;connectionTimeout=5000" /&gt;
          &lt;/route&gt;
  </code></pre>
  
  <p>This works <strong>OK</strong> for my use case. When any exception is thrown an email is sent
  indeed to the defined address.</p>
  
  <p>However in order to test for corner cases I stopped the internal email server to see what
  happens. I expected Camel to attempt an email send and stop trying after 5 seconds (as set in the connectionTimout option in the smpt URL above)</p>
  
  <p>In reallity however the WHOLE Camel application hangs! This is simply unacceptable!
  I cannot guarantee that the mail server will be up 100%.</p>
  
  <p>Am I missing something here? Should I drop the idea of email alerts altogether or does Camel need another special option for <strong>NOT</strong> hanging when the mail server is down?</p>
  
  <p><strong>Answer</strong></p>
  
  <p>The line</p>
  
  <pre><code>debugMode=true;connectionTimeout=5000 
  </code></pre>
  
  <p>should be </p>
  
  <pre><code>debugMode=true&amp;amp;connectionTimeout=5000
  </code></pre>