This site contains the documentation that is relevant to older WSO2 product versions and offerings.
For the latest WSO2 documentation, visit https://wso2.com/documentation/.

Skip to end of metadata
Go to start of metadata

You are viewing an old version of this page. View the current version.

Compare with Current View Page History

« Previous Version 2 Next »

Email event adapter is an internal event adaper that comes with WSO2 products by default.

Prerequisites

Follow the steps below to complete the prerequisites.

  1. Enable the mail transport receiver in Axis2 level by uncommenting the following line in <PRODUCT_HOME>/repository/conf/axi2/axis2.xml file:
    <transportReceiver name="mailto" class="org.apache.axis2.transport.mail.MailTransportListener"/>
  2. Remove any rich text formatting from the email body. It must contain only plain text. 

Configuring input email event adapter

The topics below explain how to configure the email input event adapter using the management console or using a configuration file.

Using the management console

  1. Log in to product management console, and click Event Processor Configs in the Configure menu.
  2. Click Add Input Event Adaptor in the Input Event Adaptors menu.
  3. Enter details as shown in the below example.

    Fields of the above screen are described below:
    • Event Adaptor Name: emailAdaptor
    • Event Adaptor Type: email
    • Receiving Mail Address: Mail address where the product used to retrieve the mails.
    • Receiving Mail Protocol: Can be either pop or imap (If you select imap, make sure it is enabled in your mail account settings).
    • Poll Interval: In which time limit the product needs to check for new mails.
    • Receiving Mail Protocol Host: pop.gmail.com (for pop) and imap.gmail.com (for imap)
    • Receiving Mail Protocol Port: 995 (for pop) and 993 (for imap)
  4. Click  Add Event Adaptor.

     

After an adapter is successfully added, click  Edit to change its configuration and redeploy it. This will open a XML-based editor allowing you to edit the event adapter configurations from the UI. Do your modifications and click  Update . You can also delete it or enable statistics and tracing using the provided UI options.

Email event adapter can be configured with XML input mapping, Text Mapping and JSON Mapping.

If there is any exception occurred continuously when sending mail, check whether email.in.subject matches with email subject that we send. (For example: If email.in.subject is TestMail then subect of the mail needs to be SOAPAction :urn:TestMail. If the issue still continues, try removing service-meta files in the deployment directory.

Using a configuration file

Follow the instructions below to configure input email event adapter using a configuration file.

  1. Create a XML file with the following Qpid input event adaptor configurations.

    Input event adaptor implementation must start with <inputEventAdaptor> as the root element.

    <inputEventAdaptor name="emailAdaptor" type="email" xmlns="http://wso2.org/carbon/eventadaptormanager">
      <property name="mail.protocol.socketFactory.fallback">false</property>
      <property name="transport.mail.Address">wso2cep@gmail.com</property>
      <property name="mail.protocol.password">mailpassword</property>
      <property name="mail.protocol.host">pop.gmail.com</property>
      <property name="mail.protocol.port">995</property>
      <property name="mail.protocol.user">wso2cep</property>
      <property name="transport.PollInterval">5</property>
      <property name="transport.mail.Protocol">pop3</property>
      <property name="mail.protocol.socketFactory.class">javax.net.ssl.SSLSocketFactory</property>
    </inputEventAdaptor>
  2. Add it in  <PRODUCT_HOME>/repository/deployment/server/inputeventadaptors/  directory.

    Since hot deployment is enabled, you can simply add/remove files to deploy/undeploy to/from the server.  

Configuring input email event adapter message properties

The configured input event adapters will be used in event builders. With input event adapter message properties, event builders will be able to extract data from the incoming events to build the event streams. Following are the specific message properties of the input email event adaptor.

  • Email Service Name : For an email to be processed through this event builder, the subject must be SOAPAction:urn:{Email Service Name}.
  • Input Mapping Type: The incoming event type to be mapped. 
  • No labels