Adapter event for the POP adapter

You can configure a POP mail monitor adapter to download or ignore attachments to the email message being monitored. 

Working with email attachments

Depending on this configuration, the <attachments> block shown in the sample event in the XML sample of the POP adapter event with attachments that are downloaded successfully might not be present. If an attachment cannot be downloaded, due to configuration settings or available disk space, the event includes a <fault-message> element in the <attachment> block, indicating the problem.

To use the data from the monitor adapter event in the triggered process, you must create inputevent, a job input parameter on the Start activity of the process. The <data> element from the monitor adapter event populates this input.

The following table describes the attachment elements for the POP mail adapter.

POP mail adapter event with <attachments> element

Element

Description

<email-message>

Contains the values for the email message

<from>

Contains the email address of the sender

<sent-date>

Specifies the date the email message is sent

<sent-epoch-milliseconds>

Specifies the date the email message is sent, in epoch time format

This value can be used to perform a date comparison in a rule.

<reply-to>

Specifies the addresses to which a reply to the email message is directed

<recipients>

Contains the email address of the recipients

<subject>

Specifies the subject line of the email message

<body>

Specifies the body of the email message

<attachments>

Contains the information about attachments to the email message

<attachment>

Contains the information about an attachment to the email message

<peer-name>

Specifies the name of the peer on which the attachment is downloaded

<download-directory>

Specifies the directory into which the attachment is downloaded

<name>

Specifies the file name of the attachment that is downloaded

The following figure shows a sample XML for an event with an attachment that is downloaded successfully. The sample shows a value for a file that is downloaded, where the value of the <create-subdirectory> element is set to true in the adapter configuration. Each attachment is evaluated independently. You can have a message with multiple attachments, some of which are downloaded successfully, while others produce a fault message.

XML sample of the POP adapter event with attachments that are downloaded successfully

<email-message>
  <from>
    <email-address>email</email-address>   
  </from>
  <sent-date>date</sent-date>
  <sent-epoch-milliseconds>date in epoch time</sent-epoch-milliseconds>
  <reply-to>
    <email-address>email</email-address>
    <email-address>email</email-address>
  </reply-to>
  <recipients>
    <email-address>email</email-address>
    <email-address>email</email-address>
  </recipients>
  <subject>subject text</subject>
  <body>body text</body>
  <attachments>
    <attachment>
    <peer-name>CDP</peer-name>
    <download-directory>/mail/downloads/user@company.com/Message1/1196967357
    </download-directory>
    <name>Test1.doc</name>
  </attachment>
  <attachment>
    <peer-name>CDP</peer-name>
    <download-directory>/mail/downloads/user@company.com/Message2/1196968330
    </download-directory>
    <name>Test2.doc</name>
    </attachment>
  </attachments>
</email-message>

Working with email recipient headers 

For a nested (forwarded) message, the adapter event XML contains the details in the header. The header contains details of all recipients (such as To, Cc, and Bcc), from, subject, and sent date. These values are included in the corresponding elements, which are added as child elements of one of the < bodypart> element in the event XML as shown in the the following figure.

The following table describes the adapter event elements for the POP mail adapter for a nested message with header details.

POP mail adapter event for a nested message with header details

Element

Description

<email-address>Contains the <recipient-type> element
<recipient-type>

Specifies the email address in the recipient list

Valid values: To, CC

 

To: value specify the email address in TO recipient list

 

Cc: value specify the email address in CC recipient list

<to>

Contains the names of all the email recipients in the To list of the nested message

<cc>

Contains the names of all the email recipients in the Cc list of the nested message

<bcc>

Contains the names of all the email recipients in the Bcc list of the nested message

<from>

Contains the email address of the sender of the nested email message

<subject>

Specifies the subject line of the nested email message

<date>

Contains the date when the nested email is sent

The following figure shows a sample XML of the POP adapter event for a nested message.

XML sample of the POP adapter event for a nested message

<email-message>
  <from>
    <email-address>abcd@xyz.com</email-address>
  </from>
  <sent-date>Thu Dec 30 14:45:40 GMT+05:30 2010</sent-date>
  <sent-epoch-milliseconds>1293700540000</sent-epoch-milliseconds>
  <reply-to>
    <email-address>abcd@xyz.com</email-address>
  </reply-to>
  <recipients>
    <email-address>qatesting102@yyy.com</email-address>
  </recipients>
  <subject>FW: This is test message with CC list nested message</subject>    
  <body>
    <bodypart>Forwarding nested message.....&#xD; &#xD;
     --ABCD&#xD;
     &#xD;
      From: ABCD&#xD;
      Sent: Friday, December 24, 2010 3:17 PM&#xD;
      To: 'test@gmail.com'&#xD;
      Cc: 'somename@gmail.com'&#xD;
      Subject: This is test message with CC list nested message&#xD; &#xD;
      This is test&#xD;
      &#xD;
     --ABCD&#xD;
     </bodypart>
     <bodypart>
      <from>ABCD &lt;test@gmail.com&gt;</from>
      <to>"ABCD" &lt;abcd@xyz.com&gt;, "test@gmail.com"&#xD;
	           &lt;test@gmail.com&gt;</to>
      <cc>"somename@gmail.com" &lt;somename@gmail.com&gt;, Some Name&#xD;
           	&lt;name2@gmail.com&gt;</cc>
      <subject>Fwd: This is the nested test message to test headers information</subject>
      <date>Fri, 24 Dec 2010 03:44:59 -0600</date>
    </bodypart>
    <bodypart>&#xD;
&#xD;
---------- Forwarded message ----------&#xD;
    From: ABCD &lt;abc@gmail.com&lt;mailto:test@gmail.com&gt;&gt;&#xD;
    Date: Fri, Dec 24, 2010 at 2:38 PM&#xD;
    Subject: This is the nested test message to test headers information&#xD;
    To: test@gmail.com&lt;mailto:test@gmail.com&gt;,
     abcd@xyz.com&lt;mailto:abcd@xyz.com&gt;,
     somename@gmail.com&lt;mailto:somename@gmail.com&gt;, Some Name 
     &lt;name2@gmail.com&lt;mailto:name2@gmail.com&gt;&gt;, Some Name2
     &lt;test@yahoo.co.in&lt;mailto:test@yahoo.co.in&gt;&gt;&#xD;
    &#xD;
    &#xD;
    This is the nested test message to test headers&#xD;
    &#xD;
    </bodypart>
  </body>
</email-message>

The following table describes the adapter event elements for the POP mail adapter with attachments that cannot be downloaded successfully.

POP mail adapter event with attachments that cannot be downloaded elements

Element

Description

<email-message>

Contains the values for the email message

<from>

Contains the email address of the sender

<sent-date>

Specifies the date the email message is sent

<sent-epoch-milliseconds>

Specifies the date the email message is sent, in epoch time format

This value can be used to perform a date comparison in a rule.

<reply-to>

Specifies the addresses to which a reply to the email message is directed

<recipients>

Contains the email address of the recipients

<subject>

Specifies the subject line of the email message

<body>

Specifies the body of the email message

<attachments>

Contains the information about attachments to the email message

<attachment>

Contains the information about an attachment to the email message

<fault-message>

Indicates the reason the attachment could not be downloaded successfully

<name>

Specifies the file name of the attachment that could not be downloaded

The following figure shows an XML sample of the adapter event for the POP adapter with attachments that cannot be downloaded successfully.

XML sample of the POP adapter event with attachments that cannot be downloaded

<email-message>
  <from>
    <email-address>email</email-address> 
  </from>
  <sent-date>date</sent-date>
  <sent-epoch-milliseconds>date in epoch time</sent-epoch-milliseconds>
  <reply-to>
    <email-address>email</email-address>
    <email-address>email</email-address>
  </reply-to>
  <recipients>
    <email-address>email</email-address>
    <email-address>email</email-address>
  </recipients>
  <subject>subject text</subject>
  <body>body text</body>
  <attachments>
    <attachment>
    <fault-message> Attachment could not be downloaded  attachment name 
      violates filter set</fault-message>
    <name>Sample1.doc</name>
    </attachment>
    <attachment>
    <fault-message> Attachment could not be downloaded as it exceeds 
      maximum attachment size limit </fault-message>
    <name>Sample2.doc</name>
    </attachment>
  </attachments>
</email-message>}

The following log sample shows an email trap received by the adapter when the adapter supports Internet protocol version 6 (IPv6):

27 Feb 2012 11:53:53,725 DEBUG BaseMailMonitorAdapter : pool-12-thread-1 POP_IPV6: Inside getText: part getLineCount is :  -1
27 Feb 2012 11:53:53,725 DEBUG BaseMailMonitorAdapter : pool-12-thread-1 POP_IPV6: Inside getText: part getFileName is :  null
27 Feb 2012 11:53:53,725 DEBUG BaseMailMonitorAdapter : pool-12-thread-1 POP_IPV6: Inside getText: part Disposition is :  null
27 Feb 2012 11:53:53,725 DEBUG BaseMailMonitorAdapter : pool-12-thread-1 POP_IPV6: Content type is =text/plain; charset="iso-8859-1"
27 Feb 2012 11:53:53,725 DEBUG BaseMailMonitorAdapter : pool-12-thread-1 POP_IPV6: Parsing body using Charset iso-8859-1
27 Feb 2012 11:53:53,725 DEBUG MailMonitorJobProcessor : pool-12-thread-1: POP_IPV6: captured the new Message from emailid@abcd.efg.com : <email-message>
  <from>
    <email-address>emailid@abcd.efg.com</email-address>
  </from>
  <sent-date>Mon Feb 27 11:53:21 IST 2012</sent-date>
  <sent-epoch-milliseconds>1330323801000</sent-epoch-milliseconds>
  <reply-to>
    <email-address>emailid@abcd.efg.com</email-address>
  </reply-to>
  <recipients>
    <email-address>emailid@abcd.efg.com</email-address>
  </recipients>
  <subject>POP POP POP POP POP POP </subject>
  <body>
    <bodypart>This is a log



Regards
My Name

</bodypart>
  </body>
</email-message>
27 Feb 2012 11:53:53,725 INFO  BaseMailMonitorAdapter : pool-12-thread-1 POP_IPV6: Sending event to adapter manager : <email-message>
  <from>
    <email-address>emailid@abcd.efg.com</email-address>
  </from>
  <sent-date>Mon Feb 27 11:53:21 IST 2012</sent-date>
  <sent-epoch-milliseconds>1330323801000</sent-epoch-milliseconds>
  <reply-to>
    <email-address>emailid@abcd.efg.com</email-address>
  </reply-to>
  <recipients>
    <email-address>emailid@abcd.efg.com</email-address>
  </recipients>
  <subject>POP POP POP POP POP POP </subject>
  <body>
    <bodypart>This is a log



Regards
My Name

</bodypart>
  </body>
</email-message>
27 Feb 2012 11:53:53,725 DEBUG MailMonitorJobProcessor : pool-12-thread-1: POP_IPV6: Event sent successfully for emailid@abcd.efg.com
27 Feb 2012 11:53:53,725 INFO  AdapterManager  : ADAPTER_MANAGER: POP_IPV6 sent event: Email received
27 Feb 2012 11:53:53,725 DEBUG AdapterProxy    : Attempting to locate a peer with a running Activity Processor instance to process a rules job...
27 Feb 2012 11:53:53,725 DEBUG AdapterProxy    : Located a running instance of the Activity Processor on peer "CDP1". Attempting to send a submit rules job request...
27 Feb 2012 11:53:53,725 DEBUG AdapterProxy    : Successfully submitted rules job to peer "CDP1".
27 Feb 2012 11:54:15,409 DEBUG AOConnectionExpirationPolicy : [Thread: Whirlycache Tuner ( named_connection_cache-AdapterConfiguration1329384830895-1628797942 )]  Performing Maintenance at 2012-02-27 11:54:15.409
27 Feb 2012 11:54:15,409 DEBUG AOConnectionExpirationPolicy : [Thread: Whirlycache Tuner ( named_connection_cache-AdapterConfiguration1329384830895-1628797942 )]  Cache size: 0
27 Feb 2012 11:54:15,409 DEBUG AOConnectionExpirationPolicy : [Thread: Whirlycache Tuner ( named_connection_cache-AdapterConfiguration1329384830895-1628797942 )] Locking ManagedCache Object...........
27 Feb 2012 11:54:15,409 DEBUG AOConnectionExpirationPolicy : [Thread: Whirlycache Tuner ( named_connection_cache-AdapterConfiguration1329384830895-1628797942 )] Unlocking ManagedCache Object...........
27 Feb 2012 11:54:18,592 DEBUG AOConnectionExpirationPolicy : [Thread: Whirlycache Tuner ( named_connection_cache-AdapterConfiguration1329297406131-1755703281 )]  Performing Maintenance at 2012-02-27 11:54:18.592
27 Feb 2012 11:54:18,592 DEBUG AOConnectionExpirationPolicy : [Thread: Whirlycache Tuner ( named_connection_cache-AdapterConfiguration1329297406131-1755703281 )]  Cache size: 0
27 Feb 2012 11:54:18,592 DEBUG AOConnectionExpirationPolicy : [Thread: Whirlycache Tuner ( named_connection_cache-AdapterConfiguration1329297406131-1755703281 )] Locking ManagedCache Object...........
27 Feb 2012 11:54:18,592 DEBUG AOConnectionExpirationPolicy : [Thread: Whirlycache Tuner ( named_connection_cache-AdapterConfiguration1329297406131-1755703281 )] Unlocking ManagedCache Object...........
27 Feb 2012 11:54:34,754 DEBUG AdapterManager  : Initiating event digest cleanup...
27 Feb 2012 11:54:34,754 DEBUG AdapterManager  : Found 0 digests to remove : []
27 Feb 2012 11:54:34,754 DEBUG AdapterManager  : Successfully removed 0 digests.
27 Feb 2012 11:54:45,424 DEBUG AOConnectionExpirationPolicy : [Thread: Whirlycache Tuner ( named_connection_cache-AdapterConfiguration1329384830895-1628797942 )]  Performing Maintenance at 2012-02-27 11:54:45.424
27 Feb 2012 11:54:45,424 DEBUG AOConnectionExpirationPolicy : [Thread: Whirlycache Tuner ( named_connection_cache-AdapterConfiguration1329384830895-1628797942 )]  Cache size: 0
27 Feb 2012 11:54:45,424 DEBUG AOConnectionExpirationPolicy : [Thread: Whirlycache Tuner ( named_connection_cache-AdapterConfiguration1329384830895-1628797942 )] Locking ManagedCache Object...........
27 Feb 2012 11:54:45,424 DEBUG AOConnectionExpirationPolicy : [Thread: Whirlycache Tuner ( named_connection_cache-AdapterConfiguration1329384830895-1628797942 )] Unlocking ManagedCache Object...........
27 Feb 2012 11:54:48,606 DEBUG AOConnectionExpirationPolicy : [Thread: Whirlycache Tuner ( named_connection_cache-AdapterConfiguration1329297406131-1755703281 )]  Performing Maintenance at 2012-02-27 11:54:48.606
27 Feb 2012 11:54:48,606 DEBUG AOConnectionExpirationPolicy : [Thread: Whirlycache Tuner ( named_connection_cache-AdapterConfiguration1329297406131-1755703281 )]  Cache size: 0
27 Feb 2012 11:54:48,606 DEBUG AOConnectionExpirationPolicy : [Thread: Whirlycache Tuner ( named_connection_cache-AdapterConfiguration1329297406131-1755703281 )] Locking ManagedCache Object...........
27 Feb 2012 11:54:48,606 DEBUG AOConnectionExpirationPolicy : [Thread: Whirlycache Tuner ( named_connection_cache-AdapterConfiguration1329297406131-1755703281 )] Unlocking ManagedCache Object...........
27 Feb 2012 11:54:53,661 DEBUG PopMailMonitorThread : pool-11-thread-1: Adapter: POP_IPV6 target: emailid@abcd.efg.com closing folder
27 Feb 2012 11:54:53,661 DEBUG PopMailMonitorThread : pool-11-thread-1: POP_IPV6: Opening folder for target

Handling javax.mail.internet.AddressException

If the email sender does not specify the recipient email addresses in the recipient headers of the message as per the RFC standards, the adapter fails with the javax.mail.internet.AddressException where the API is unable to parse the recipients list and unable process the email event.

The adapter has now been enhanced to directly retrieve the recipients list from the recipient headers in a string format separated by a delimiter and add to the email event in the following format inside the <recipients> element.  

<recipients>
  <To><![CDATA[abc@aps-eml.com, allen@aps-eml.com]]></To>
  <Cc><![CDATA[xyz@aps-eml.com, xyz@aps-eml.com;myemail@gmail.com;]]></Cc>
</recipients>
Was this page helpful? Yes No Submitting... Thank you

Comments