Receiving an email
You can receive an email, with or without attachments, from an email server that supports Post Office Protocol 3 (POP3) or Internet Message Access Protocol (IMAP).
Before you begin
This topic assumes that you have already created a message flow. For more information, see Creating a message flow.
About this task
- Add an EmailInput node to your message flow.
- Edit the following EmailInput node properties:
- On the Basic tab, add the email server URL, or the EmailServer configurable service name as the Email server property value, as described in EmailInput node. For example, pop3://myemailserver.com:12345 or imap://myemailserver.com:56789.
- On the Security tab, add the security identity object name of the email server user ID and password pair as the Security identity property value. For more information about email server security identity support, see mqsisetdbparms command.
- Configure the following properties on the Retry tab:
- Retry mechanism: The Retry mechanism property defines how the EmailInput node handles a message flow failure. Valid values are Failure, Short Retry, or Short and Long Retry. The default value for this property is Short and long retry, which indicates that the email is retried until the short retry threshold is met, then long retry takes place, meaning that the email is never deleted from the email server, but also that the email is infinitely retried. Emails are deleted from the email server if the email message fails and this property value is not set to Short and Long Retry.
- Retry threshold: The Retry threshold property is the number of times to try the message flow transaction again when the Retry mechanism property value is set to Short Retry. The default value for this property is 0.
- Short retry interval (in seconds): The Short retry interval is the interval, in seconds, between each retry if the Retry threshold property value is not set to zero. The default value for this property is 0. If the email is retried until the short retry threshold is met and the email fails, the email is routed to the failure terminal, and the email is deleted from the email server.
- Long retry interval (in seconds): The Long retry interval is the interval, in seconds, between each retry, if the Retry mechanism property value is Short and Long Retry, and the short retry threshold has been exhausted. The default value for this property is 300 seconds.
- Action on failing email: The Action on failing email property determines the action that the EmailInput node takes with the input data source after all attempts to process the email contents fail. The Action on failing email property is a read only property that is set to a default value of Delete Email, which is used with the Retry mechanism property. If the Retry mechanism property is set to Short and Long Retry, the message flow continues to try to retrieve the email from the email server, meaning that the email is never deleted. If the Retry mechanism property is not set to Short and Long Retry, the Action on failing email property value Delete Email is used, and the email is deleted from the email server.
- Save the changes.
- Add the message flow to the BAR file and deploy.
When a message is passed into the deployed EmailInput node, an email is received from the email server and the body of the email message, and any attachments, are propagated in the Multipurpose Internet Mail Extensions (MIME) domain. All other information relating to the email is stored in the Root.EmailInputHeader MIME logical tree. For a complete list of the email elements that are propagated in the MIME logical tree when you use an EmailInput node, see EmailInput node.When an email containing an attachment is received, the EmailInput node places different parts of the email body in the MIME domain, so that they are associated with the MIME parser. The MIME tree location that the EmailInput node builds to house the information is the same location that the EmailOutput node expects email data to be in when sending an email. The attachment is stored in the MIME logical tree in directory Root.MIME.Parts.Part.Data. Where Content-Type describes the type of data that is in the attachment.
Viewing the Root.Properties.ContentType value in the MIME domain allows you to write logic to parse the attachment. For more information about the MIME logical tree, see MIME parser and domain.
Received emails are deleted from an email server that supports POP3 or IMAP only when the emails have been successfully propagated after being processed by the EmailInput node Failure, Out, or Catch terminals, and the message flow has successfully executed. This does not form part of a globally coordinated transaction.
- The Failure terminal is not connected.
- An exception occurs in the Failure terminal.
- The email message fails and the Retry mechanism property value is not set to Short and Long Retry.
- The Retry threshold is not set to 0 and the Short retry interval property value has been exhausted.