Email Trigger V2
Know the trigger and how to use it.
IMPORTANT: This trigger supports IMAP protocol only.
Email trigger delivers data from an email inbox into the pipeline. Learn the configuration parameters on the example below:
1. Open the trigger configurations and select the email-V2 type.
2. Fill the configuration fields:
- Account: specify the account for the trigger to access the correct email.
- Operation: choose the option "mark as read" (there’re other options, which will be explained later).
- Hostname: insert the IMAP server hostname (eg.: imap.uol.com).
- Port: determine the port.
- Email Folder: define the name of the folder / inbox that the trigger must read (eg.: inbox). This folder can’t hold more than 100 messages (read/not read).
- Destination Email Folder: point which folder the message should be moved to. Keep in mind that this field appears only when the option "move to another folder" is selected in the Operation parameter. In this example, "mark as read" was selected, so the field will not be available.
- Maximum Timeout: fill the maximum time for the trigger execution.
- Allow Redelivery Of Messages: if enabled, the option allows the messages to be delivered again in the Pipeline Engine fails.
3. Click on "Confirm".
4. Continue to build the pipeline.
5. Connect the components.
6. Deploy the pipeline:
- Click on "Run", located in the superior part of the screen.
- Select the environment, which can be test or prod.
- Click on "Create a new implantation".
- Select the pipeline with its version and capacity.
- Click on "Confirm".
7. When triggered, the pipeline will receive a payload similar to this one:
"htmlMessage": "Hello, Peter\r\nI still haven’t received the report for this month. Could you send it by the end of the day?",
"attachments": ["attachment_fileName1", "attachment_fileName2", "attachment_fileName3"]
"subject": "Monthly report",
- data: message content
- subject: message subject
- from: sender email
- to: recipient email
- cc: recipients in copy
- bcc: recipients in hidden copy
- replyTo: email the answer is sent to
- sentDate: date when the message was sent
- receivedDate: date when the message was received
- mark as read: select this option if, after being processed, you want the message to be marked as “read”.
- move to another folder: select this option if, after being processed, you want the message to be moved to a predetermined folder. The destination is specified in the "Destination email folder" field, which only appears in the configurations when "move to another folder" is selected.
- delete: select this option if, after being processed, you want the message to be deleted.
If there's some attachment in the body of the message received by the trigger, it will download them and make them available inside the pipeline execution directory. The attachment names will be contained inside the attachments property and this property will be an array of strings containing the attachments names.
IMPORTANT: if there’re 2 attachments with the same name in the message, an unique identifier will be added in the name of the downloaded attachment.
There’re 2 attachments with the name "file.csv" inside the message. Therefore, the content of the attachments property will be:
"attachments": ["file.csv", "0072e485-8ba2-4f79-bba5-8068e37ee792_file.csv"]
The identifier varies at each execution.
Note: If you use Gmail as IMAP server host, it will be necessary to authorize the support of non-safe applications. Click here to see the step-by-step.