This component has been deprecated in favor to servicemix-mail component.

We currently support MIME email sending via JavaMail. The following example shows the configuration of the JavaMail email sender component.

{snippet:id=mime|lang=xml|url=servicemix/smx3/trunk/common/servicemix-components/src/test/resources/org/apache/servicemix/components/email/example.xml}

We also support the simpler MailSender from Spring, such as to work with COS.

{snippet:id=simple|lang=xml|url=servicemix/smx3/trunk/common/servicemix-components/src/test/resources/org/apache/servicemix/components/email/example.xml}

Using message properties

The default configuration of the email sender uses the supplied message properties to figure out how to send the email. The following code shows this in use

{snippet:id=email|lang=java|url=servicemix/smx3/trunk/common/servicemix-components/src/test/java/org/apache/servicemix/components/email/EmailTest.java}

Using expressions

You can also use Expressions to configure the various properties on the email. The following example uses a mixture of constant expression and XPath expressions. This means that the sender component will use XPath to extract information from the message content and use that to create the email.

{snippet:id=xpath|lang=xml|url=servicemix/smx3/trunk/common/servicemix-components/src/test/resources/org/apache/servicemix/components/email/simpleMail.xml}

This example uses property expressions; that is extracting properties from the message.

{snippet:id=simpleExpr|lang=xml|url=servicemix/smx3/trunk/common/servicemix-components/src/test/resources/org/apache/servicemix/components/email/simpleMail.xml}