Monitors an email server for incoming mail and fires when email arrives.
Properties
Server
Sets the host name of the email server.
Polling Delay
Sets a time expression that specifies how long the mail trigger waits to poll the mail server for new email messages.
Port
Sets the mail server port.
Username & Password
Sets the credentials to access the mail server
Protocol
Sets the mail protocol used to communicate with the mail server. It can be either IMAP or POP3
Delete Processed Message
Sets whether a processed email is automatically deleted after control returns to the mail trigger. Note that when using the POP3 protocol, the JavaMail implementation does not appear to allow messages to be deleted.
IMAP Folder
Sets the name of the IMAP folder that is checked for email messages.
IMAP Folder Copy Destination
Sets the name of an IMAP folder, if any, to which a processed email is copied when the mail trigger fires.
Results
The Mail Trigger returns its results in the flow context variable "result". These results include information about the mail subject and its body, the addresses associated with the mail, and attachments for the mail. You can access the Mail Trigger results from the following fields:
Flow Context Variable
|
Field
|
Java Type
|
Description
|
Prescript / Postscript Example
|
|
---|---|---|---|---|---|
RESULT |
attachments |
List<MailTrigger.MailAttachment> |
The file attachments in the mail message. See Using MailAttachments below for more information. |
|
|
RESULT |
body |
String |
The body of the mail message. |
|
|
RESULT |
cc_addresses |
List<String> |
The carbon copy recipients of the mail message. |
|
|
RESULT |
content_type |
flux.notification.MailContentType |
The content type of the mail message. |
|
|
RESULT |
from_addresses |
List<String> |
The senders of the mail message. |
|
|
RESULT |
reply_to_addresses |
List<String> |
The reply-to addresses of the mail message. |
|
|
RESULT |
sent_date |
Date |
The date the mail message was sent. |
|
|
RESULT |
size |
int |
The size of the mail message. |
|
|
RESULT | status_flags | javax.mail.Flags | Status flags for the email message. |
|
|
RESULT |
subject |
String |
The subject of the mail message. |
|
|
RESULT |
to_addresses |
List<String> |
The recipients of the mail message. |
|
Passing Results with a Runtime Data Map
You can use a Runtime Data Map to copy one of the result fields into a new variable (for future reference or to reuse the data later in the workflow).
To copy a result field, you can use a data map like:
Using MailAttachments
If a message picked up by a mail trigger contains attachments, they are returned as MailAttachment objects. These objects have two fields:
Field
|
Description
|
Prescript / Postscript Example
|
|
---|---|---|---|
body | A byte[] containing the body (content) of the attachment. |
|
|
filename | The filename of the attachment. |
|
You can also access the attachments through runtime data mapping. For example, you could use the following data map to pass the attachments from the mail trigger into a for each collection element action:
Once the for each collection element action adds the next attachment to the flow context, you can access its fields with another data map:
Comments
Please sign in to leave a comment.