Skip to content

Switching from FTP Listener to Mail Sender

This example demonstrates how WSO2 Micro Integrator receives messages through the FTP transport listener and forwards the messages through the mail transport sender.

VFS transport listener will pick the file from the directory in the FTP server. The file in the FTP directory will be deleted. The response will be sent to the given e-mail address.

Synapse configuration

Following are the integration artifacts that we can used to implement this scenario. See the instructions on how to build and run this example.

<proxy name="SFTPtoMailToProxy" startOnLoad="true" transports="vfs" xmlns="">
    <parameter name="transport.vfs.FileURI">vfs:sftp://guest:guest@localhost/test?vfs.passive=true</parameter> <!--CHANGE-->
    <parameter name="transport.vfs.ContentType">text/xml</parameter>
    <parameter name="transport.vfs.FileNamePattern">.*\.xml</parameter>
    <parameter name="transport.PollInterval">15</parameter>
            <header name="Action" value="urn:getQuote"/>
                    <address uri="http://localhost:9000/services/SimpleStockQuoteService"/>
            <property action="set" name="OUT_ONLY" value="true"/>
                    <address uri="mailto:user@host"/>
    <publishWSDL key="conf:custom/sample_proxy_1.wsdl" preservePolicy="true"/>

Build and Run

Create the artifacts:

  1. Set up WSO2 Integration Studio.
  2. Create an ESB Solution project.
  3. Add sample_proxy_1.wsdl as a registry resource.
  4. Create the proxy service with the VFS configurations parameters given above.


    Update the registry path to the WSDL file accordingly.

  5. Configure MailTo transport sender.

  6. Deploy the artifacts in your Micro Integrator and start the Micro Integrator.

Set up the back-end service.

  1. Download the stockquote_service.jar

  2. Open a terminal, navigate to the location of the downloaded service, and run it using the following command:

    java -jar stockquote_service.jar

Add the following request.xml file to the SFTP location and verify the content received via the MailTo transport.

<soapenv:Envelope xmlns:soapenv="">
    <m0:getQuote xmlns:m0="http://services.samples">