Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

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

Table of Contents

Before configuration begins,products by default. It can be configured with XML, text, and JSON input mapping types.

Excerpt
hiddentrue

NOTE TO WRITERS: Add the TOC here.

Table of Contents
maxLevel3

Prerequisites

Follow the steps below to complete the prerequisites before starting the input adapter configurations.

  1. Enable the mail transport receiver in axis2 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

You can configure the email input event adapter using the management console or using an XML file as explained in step 5a configuration file.

Anchor
Using the management console
Using the management console
Configure using the management console

Follow the instructions below to configure input email event adapter using the management console. This deploys the event adapter in the <PRODUCT_HOME>/

repository/deployment/server/inputeventadaptors/ directory.

  1. Log in to the CEP product's management console, go to Configure -->  and click Configure.
  2. Click Input Event Adaptors in the Event Processor Configs --> Input Event Adaptors and click menu, and then click Add Input Event Adaptor. Then select 'email' as the Event Adaptor Type.
  3. Enter

    the

    details as shown in the

    form that appears to create an input adaptor and click Add Event Adaptor. For example,
    Image RemovedFields

    below example.
    create input email event adapterImage Added
    Properties of the above

    screen

    configuration are described below

    :

    . 

    PropertyDescription
    Event Adaptor NameName of the input event adapter
    Event Adaptor TypeType of the input event adapter
    Receiving Mail Address
    :
    Mail address, where
    CEP
    the product used to retrieve the mails
    .
    Receiving Mail Protocol
    :
    Can be either
    pop
    POP or
    imap
    IMAP (If you select
    imap
    IMAP, make sure it is enabled in your
    mail
    email account settings)
    .
    Poll Interval
    : In which
    The time limit
    CEP
    , in which the product needs to check for new mails
    .
    Receiving Mail Protocol Host:pop.gmail.com
    (
    for
    pop)
    POP, and imap.gmail.com
    (
    for
    imap)
    IMAP
    Receiving Mail Protocol Port
    :
    995
    (
    for
    pop)
    POP, and 993
    (for imap)

    Following values are used in the configuration above:

    No Format
    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
  4. 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.
  5. 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.
  6. Alternatively, Anchorstep5step5you 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>
    for IMAP
    User NameUsername of the email account
    PasswordUsername of the email account
    Receiving Mail Protocol Port SocketFactory ClassClass of the receiving mail protocol port
    Receiving Mail Protocol SocketFactory FallBackTo enable or disable fallback of the receiving mail protocol class

     

  7. Click  Add Event Adaptor.

Anchor
Using the management console
Using the management console
Configure using a configuration file

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

...

  1. Create an XML file with the following input email event adapter configurations. Input event adaptor implementation must start with <inputEventAdaptor> as the root element.

    Code Block
    languagehtml/xml
    <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>

...

  1. Add the XML file to the  <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.  

Info
After an adapter is successfully added, it gets added to the list of adapters displayed under Event Processor Configs in the Configure menu of the product's management console. Click Edit to change its configuration and redeploy it. This opens an 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, enable/disable statistics or enable/disable tracing on it using the provided options in the UI.
Info

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

Configuring

...

input email event adapter message properties

The configured Input Event Adaptors will be used in Event Builders, with Input Event Adaptor message properties, Event Builders will be input event adapters are used in event builders. With input event adapter message properties, event builders are able to extract data from the incoming events to build the event streams. Following are the Input Email Event Adaptor the specific message properties of the input email event adapter.
input email event adapter message propertiesImage Modified
The message properties of the input email event adapter are described below.
PropertDescription
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

...

.