Gmail Service in Mule ESB

The following example shows how to expose a SOAP service that send a mail using the SMTP outbound and the Gmail connector.

GmailService-config.xml (mule-config.xml file)

Github

In resume a simple CXF service is being exposed to send some text through Gmail.

The GmailService.java class is used to return the payload to Mule’s flow.

An Echo component is added to generate the response flow, and a SetPayload Transformer is placed to generate the response text.

The Logger component is useful to keep a track of the message that you want to send.

You have to consider the following things before you test the service:

  • The “user” attribute uses the escape code of “%40” to replace the “@” symbol.
  • As the “user attribute the “password” needs “%40” escape code too every time you want to place an “@”.
  • Note that in “from” and “to” attributes the “@” symbol will work perfectly.

 
IGmailService.java

Github

This will expose a simple CXF service in Mule ESB with a method called “sendMail” that accept a String as input.

GmailService.java

Github

This class returns the text that was passed through the Web Service to the Mule’s payload.
 
You can find the project in Github here.
 
Here is the source code of the project

7 comments: On Gmail Service in Mule ESB

Leave a reply:

Your email address will not be published.

Copyright © 2016 Marco Tello.