<transportSender name="mailto" <transportSender name="mailto" class="org.apache.axis2.transport.mail.MailTransportSender">
<parameter name="mail.smtp.host">smtp.gmail.com</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">synapse.demo.0</parameter>
<parameter name="mail.smtp.password">mailpassword</parameter>
<parameter name="mail.smtp.from">synapse.demo.0@gmail.com</parameter>
</transportSender>
<transportReceiver name="mailto" class="org.apache.axis2.transport.mail.MailTransportListener"/>
2. Register the ApplicationXMLFormatter as the formatter for text/html content type in the axis2.xml
<:messageFormatter contentType="text/html" class="org.apache.axis2.transport.http.ApplicationXMLFormatter"/>
3. In the mediation sequence, set the messageType property as well as the ContentType property to text/html (Setting both parameters is crucial to get this working. The messageType parameter is looked up by the mail transport to select the correct formatter. The other property is used by the formatter to set the right content type on the outgoing message.)
The sample proxy configuration is attached for your reference.
<proxy name="StockQuoteProxy" transports="http" xmlns="http://ws.apache.org/ns/synapse">
<target>
<inSequence>
<property name="Subject" value="Custom Subject for Response" scope="transport"/>
<property name="messageType" value="text/html" scope="axis2"/>
<property name="ContentType" value="text/html" scope="axis2"/>
<property name="OUT_ONLY" value="true"/>
<script language="js"><![CDATA[
mc.setPayloadXML(<h1>WSO2 ESB Rocks!</h1>);
]]></script>
<log level="full"/>
<send>
<endpoint>
<address uri="mailto:test@test.com"/>
</endpoint>
</send>
</inSequence>
</target>
</proxy>
4. To test the sample, simply send a request to the sample proxy service using the sample Axis2 client. That will send an e-mail with in-line HTML content to the target endpoint.
eg.
wso2esb-3.0.0/samples/axis2Client$ ant stockquote -Daddurl=http://localhost:8280/services/StockQuoteProxy