This version of the product has reached End of Life and is no longer supported. You can switch to the latest version, or use the version selector in the left navigation.

Email Transport Reference

Mule runtime engine version 3.8 reached its End of Life on November 16, 2021. For more information, contact your Customer Success Manager to determine how to migrate to the latest Mule version.

The email transport is comprised of several transports for email connectivity. The implementation supports CC/BCC/ReplyTo addresses, attachments, custom Header properties and customizable authentication. See each email transport page for more details.

Configuration Examples

Here is a configuration snippet from the bookstore example. This flow is triggered when you send a string to vm://emailNotification and sends an order verification email to a specified address:

<flow name="EmailNotificationService">
    <vm:inbound-endpoint path="emailNotification" exchange-pattern="one-way" />
    <smtps:outbound-endpoint user="${user}" password="${password}" host="${host}" from="${from}" subject="Your order has been placed!">
        <custom-transformer class="org.mule.example.bookstore.transformers.OrderToEmailTransformer" />
        <email:string-to-email-transformer />

Here is a configuration snippet from the errorhandler example. This endpoint takes a ErrorMessageToExceptionBean java object and converts it to an email to a specified address:

<smtp:outbound-endpoint user="${smtp.username}"
    host="${smtp.host}" port="${smtp.port}"
    to="${email.toAddress}" from="${email.fromAddress}"
    <transformer ref="ErrorMessageToExceptionBean" />
    <transformer ref="ExceptionBeanToXML" />

You can find full working configuration examples in each transport reference page.

The full example code for the bookstore and errorhandler examples are included in the full Mule distribution.


Filters can be set on an endpoint to filter out any unwanted messages. The email transport provides filters you can use directly or extended to implement custom filtering rules.

Filter Description


A base filter implementation that must be extended by any other mail filter.


Applies a regular expression to a Mail Message subject.

This is how you define the MailSubjectRegExFilter in your Mule configuration:

<message-property-filter pattern="to=barney@mule.org"/>

The pattern attribute is a regular expression pattern. This is defined as java.util.regex.Pattern.


Email Transport

The email transport supplies various email connectivity options.


These are transformers specific to this transport. Note that these are added automatically to the Mule registry at start up. When doing automatic transformations these are included when searching for the correct transformers.

Name Description


Converts an email message to string format.


Converts a string message to email format.


Converts an object to MIME format.


Converts a MIME message to a byte array.


Converts a byte array message to MIME format.

Define transformers in your Mule configuration file:

<email:bytes-to-mime-transformer encoding="" ignoreBadInput="" mimeType="" name="" returnClass="" xsi:type=""/>
<email:email-to-string-transformer encoding="" ignoreBadInput="" mimeType="" name="" returnClass="" xsi:type=""/>
<email:mime-to-bytes-transformer encoding="" ignoreBadInput="" mimeType="" name="" returnClass="" xsi:type=""/>
<email:object-to-mime-transformer encoding="" ignoreBadInput="" mimeType="" name="" returnClass=""
useInboundAttachments="true" useOutboundAttachments="true"/>
<email:string-to-email-transformer encoding="" ignoreBadInput="" mimeType="" name="" returnClass="" xsi:type=""/>

Each transformer supports all the common transformer attributes and properties.


A reference to a transformer defined elsewhere.

Table 1. Attributes of <transformer…​>
Name Type Required Description




The name of the transformer to use.

No Child Elements for transformer.

The object-to-mime-transformer has the following attributes:

Attribute Description Default Value


Whether to transform inbound attachment in the input message into MIME parts.



Whether to transform outbound attachment in the input message into MIME parts.


To use these transformers, make sure you include the 'email' namespace in your Mule configuration.


The following known limitations affect email transports:

  • MULE-3662 - Can’t send same object to different email users

  • MULE-1252 - MailSubjectRegExFilter cannot handle mails with attachments

Was this article helpful? Thanks for your feedback!
View on GitHub