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

Version 1 Next »

Email event adaptor is an internal event adaptor that comes with WSO2 CEP by default.

Before configuration begins,

  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 Adaptor

The topics below explain how to configure the Email input event adaptor using the management console or using an XML file as explained in step 5.

  1. Log in to the CEP management console, go to Configure -->  Event Processor Configs --> Input Event Adaptors and click Add Input Event Adaptor. Then select 'email' as the Event Adaptor Type.
  2. Enter the details in the form that appears to create an input adaptor and click Add Event Adaptor. For example,
    Fields of the above screen are described below:
    • Receiving Mail Address : Mail address where CEP 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 CEP 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)

    Following values are used in the configuration above:

    Event Adaptor Name                                  : emailAdaptor
    Event Adaptor Type                                  : email
    Receiving Mail Address                              : wso2cep@gmail.com
    Receiving Mail Protocol                             : pop3
    Poll Interval(in seconds)                           : 5
    Receiving Mail Protocol Host                        : pop.gmail.com
    Receiving Mail Protocol Port                        : 995
    User Name                                           : wso2cep
    Password                                            : wso2cep
    Receiving Mail Protocol Port SocketFactory Class    : javax.net.ssl.SSLSocketFactory
    Receiving Mail Protocol Port SocketFactory Fallback : false
  3. After the adapter is successfully created, you can change its configuration and redeploy it. To do this, click the Edit link associated with it. You can also click the other links associated with it to delete it or enable statistics and tracing.
  4. An XML editor opens with basic code, allowing you to edit the event adaptor configuration from UI itself, without having to edit the file in the file system. Do your modifications and click Update.
  5. Alternatively, you can specify an event adaptor configuration using an XML file and save it in <PRODUCT_HOME>/repository/deployment/server/inputeventadaptors directory, which is the Input event adaptor deployment directory. Since hot deployment is enabled, you can simply add/remove files to deploy/undeploy from the server.

    Create the XML file with the following Email input event adaptor configurations. Input event adaptor implementation must start with <inputEventAdaptor> 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>

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

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

Configuring Input Email Event Adaptor Message Properties

The configured Input Event Adaptors will be used in Event Builders, with Input Event Adaptor message properties, Event Builders will be able to extract data from the incoming events to build the event streams. Following are the Input Email Event Adaptor specific message properties

  • 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. The Input JMS Event Adaptor supports XML, Json and text mappings.


  • No labels