Adapter event for the IMAP adapter
You can configure an IMAP mail monitor adapter to download or ignore attachments to the email message being monitored.
Working with email attachments
The sample event in the following figure shows a configuration to display attachments. The sample shows a value for a file that is downloaded, where the <create-subdirectory> element is set to true in the adapter configuration. If an attachment cannot be downloaded, the event includes a <fault-message> element in the <attachment> block, indicating the problem. Each attachment is evaluated independently. You can have a message with multiple attachments, some of which are downloaded successfully, while others produce an error or fault message.
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 <attachments> element for the IMAP mail adapter.
IMAP mail adapter event with <attachments> element
The following figure shows a sample XML of the IMAP adapter event with an attachment that is downloaded successfully.
XML sample of the IMAP adapter event with an attachment downloaded successfully
<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>
<bodypart>This is attachment
</bodypart>
<bodypart>This is the content of the message part of Content-Type text/plain or
text/html (which appears as an attachment with content disposition value inline and
null description value) is added in bodypart instead of an attachment.#xD;
</bodypart>
</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 XML sample of the IMAP adapter event for a nested message.
The following table describes the adapter event elements for the IMAP mail adapter for a nested message with header details.
IMAP mail adapter event for a nested message with header details
The following figure shows a sample XML of the IMAP adapter event for a nested message.
XML sample of the IMAP adapter event for a nested 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.....
 
--ABCD

From: ABCD
Sent: Friday, December 24, 2010 3:17 PM
To: 'test@gmail.com'
Cc: 'somename@gmail.com'
Subject: This is test message with CC list nested message
 
This is test

--ABCD
</bodypart>
<bodypart>
<from>ABCD <test@gmail.com></from>
<to>"ABCD" <abcd@xyz.com>, "test@gmail.com"
<test@gmail.com></to>
<cc>"somename@gmail.com" <somename@gmail.com>, Some Name
<name2@gmail.com></cc>
<subject>Fwd: This is the nested message to test headers information</subject>
<date>Fri, 24 Dec 2010 03:44:59 -0600</date>
</bodypart>
<bodypart>

---------- Forwarded message ----------
From: ABCD <abc@gmail.com<mailto:test@gmail.com>>
Date: Fri, Dec 24, 2010 at 2:38 PM
Subject: This is the nested test message to test headers information
To: test@gmail.com<mailto:test@gmail.com>,
abcd@xyz.com<mailto:abcd@xyz.com>,
somename@gmail.com<mailto:somename@gmail.com>, Some Name
<name2@gmail.com<mailto:name2@gmail.com>>, Some Name2
<test@yahoo.co.in<mailto:test@yahoo.co.in>>


This is the nested test message to test headers

</bodypart>
</body>
</email-message>
The following table describes the adapter event elements for the IMAP mail adapter with an attachment that cannot be downloaded.
IMAP mail adapter event elements for an attachment that cannot be downloaded
The following figure shows a sample XML of the adapter event for the IMAP adapter with an attachment that cannot be downloaded.
XML sample of the IMAP mail adapter event with an attachment that cannot be downloaded
<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 figure shows a sample XML of the IMAP adapter event when the <ignore-peer-name-in-attachment> element is set to true while configuring the adapter.
XML sample of the IMAP mail adapter event when ignore-peer-name-in-attachment> is set to true
<from>
<email-address>abc@gmail.com</email-address>
</from>
<sent-date>Fri Jun 11 19:02:11 GMT+05:30 2010</sent-date>
<sent-epoch-milliseconds>1276263131000</sent-epoch-milliseconds>
<reply-to>
<email-address>abc@gmail.com</email-address>
</reply-to>
<recipients>
<email-address>username@runbox.com</email-address>
</recipients>
<subject>IMAP</subject>
<body>
<bodypart>This is attachment
</bodypart>
</body>
<attachments>
<attachment>
<download-directory>C:\AO\CDP\tomcat\temp\username@runbox.com</download-directory>
<name>test.txt</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):
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.
<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>