Monday, October 24, 2011

Mule smtp outbound using Gmail

Following mule flow reads files from a directory and sends the content of the files to an email using gmail account.

<?xml version="1.0" encoding="UTF-8"?>

<mule xmlns="" xmlns:file=""
xmlns:smtps="" xmlns:doc=""
xmlns:email="" xmlns:spring=""
xsi:schemaLocation=" ">
<spring:beans />

<smtps:connector name="smtpsGmailConnector"
fromAddress="" ccAddresses="">

<smtps:header key="mail.transport.protocol" value="smtps" />
<smtps:header key="mail.smtps.auth" value="true" />
<smtps:header key="mail.smtps.quitwait" value="false" />
<smtps:tls-client />
<smtps:tls-trust-store path="greenmail-truststore" />

<flow name="9f1f86a7-021f-4d20-b062-40fcd1c6c9fa">
<file:inbound-endpoint path="E:/someDir"
pollingFrequency="1000" fileAge="500" reverseOrder="false" doc:name="File"
doc:description="Read/write a file from the filesystem" />

<smtps:outbound-endpoint connector-ref="smtpsGmailConnector"
user="yourid" password="yourpassword" host=""
subject="Your order has been placed!">

<email:string-to-email-transformer />

Run with mule

Put some text file int the directory "E:/someDir"

Console will look something like the following image

1 comment:

  1. Great Article. its is very very helpful for all of us and I never get bored while reading your article because, they are becomes a more and more interesting from the starting lines until the end.

    Mulesoft online training bangalore