How to send an Email using WSO2 ESB

This post explains how to send an email in WSO2 ESB using Payload Factory mediator . You can find plenty of examples which do the same by using Script mediator.

This example is tested in WSO2 ESB 4.8

1.Uncomment and configure the SMTP server information ESB_HOME/repository/conf/axis/axis2.xml file as below

<transportSender name="mailto" class="org.apache.axis2.transport.mail.MailTransportSender">
   <parameter name=""></parameter>
   <parameter name="mail.smtp.port">587</parameter>
   <parameter name="mail.smtp.starttls.enable">true</parameter>
   <parameter name="mail.smtp.auth">true</parameter>
   <parameter name="mail.smtp.user">esbadmin</parameter>
   <parameter name="mail.smtp.password">*****</parameter>
   <parameter name="mail.smtp.from"></parameter>

2. Start the ESB and add the following proxy.

<proxy xmlns=""
   <property name="messageType" value="text/html" scope="axis2" type="STRING"/>
   <property name="ContentType" value="text/html" scope="axis2"/>
   <property name="Subject" value="Testing ESB" scope="transport"/>
   <property name="OUT_ONLY" value="true"/>
   <property name="FORCE_SC_ACCEPTED" value="true" scope="axis2"/>
   <payloadFactory media-type="xml">
         <ns:text xmlns:ns="">$1</ns:text>
         <arg value="Hello WSO2.....!"/>
         <address uri=""/>

3. When you send a request to this proxy service, should receive a mail from