Pages

Receiving an email & reading the content or attachments using WSO2 ESB

Introduction


We can receive emails that are intended for some email address of a mail server, process the content of the email including email body content, attachments etc. I am using WSO2 ESB 4.8.1 and the latest version of the product can be downloaded from here.


Enabling the Mail Transport


We should enable mail transport listeners in WSO2 ESB in order to receive emails. For that go to {ESB_HOME}/repository/conf/axis2/axis2.xml and uncomment the following line:


Configuring the Proxy Service


Configure the mail proxy with your receiving email address and the mail server settings. 
In this example my email address is wso2esb481@gmail.com and password is password.


Preparing the Attachment File

Insert the content that you want to process inside a SOAP11 envelope body into the file that should be attached. In this post I put some XML content that should be processed and the attachment file would look like this: Send the email to the specified address (in this case wso2esb481@gmail.com) and it would print something like this in the carbon console. 
As you can see, the content of the attachment and email body content are printed in the carbon console. You can process them as you wish.




No comments:

Post a Comment