Skip to content

Email IMAP/OAuth2

Get the content of a recent email from Gmail, Yahoo, Hotmail... or a custom email. The content can be a text, a link,...

Email Service

Select the email service from which to retrieve email content:

  • Gmail: Read email content from Gmail.
  • Outlook/Hotmail: Read email content from Hotmail/Outlook.
  • Yahoo: Read email content from Yahoo.
  • Custom: Read email content from a custom service.

Advanced Configuration

  • IMAP Server: The IMAP server is pre-configured (except for custom email services).
  • Connection Port: Port for connecting to services other than the default ones.
  • Secure TLS Connection: Ensures secure communication.

Email

Enter the email address to read content from.

Password

Enter the password for the account from which to read content.

ClientId

A unique identifier for the application registered with Microsoft Azure App Registration. It informs Microsoft which application is requesting access to user data (in this case, Hotmail/Outlook emails).

RefreshToken

A refresh_token is used to renew an access_token (a short-lived access token). The access_token typically lasts for 1 hour, after which the refresh_token is needed to obtain a new access_token without requiring the user to log in again.

Advanced filters

  • Folder: Retrieve email content from specific mailbox folders (e.g., INBOX or JUNK).
  • Read Emails from (n Minutes) Ago: Read content from emails sent within the specified time frame from the present.
  • From includes: Enter the sender’s email address for the emails to read.
  • To includes: Enter the recipient’s email address for the emails to read.
  • Subject includes: Enter the subject of the emails to read.
  • Body includes: Enter any content within the emails to read.

Regex extract data

Extract content based on the specified regex. If left blank, all text in the email is retrieved.

  • Match All (g): Retrieve all text matching the selector.
  • Ignore Case (i): Retrieve text matching the selector, case-insensitive.
  • Multiline (m): Select matching text across multiple lines.

Timeout

Maximum time to wait for finding and reading email content.

Mark as Read

After reading, the email is marked as read.

Assign to Variable

Assign the text to a Variable.

  • Variable Name: Specify the variable name to assign the text to. This field is optional when Assign to Variable is selected.

Insert into Table

Assign the text to a column in a Table.

  • Select Column: The column where the text will be inserted. This field is optional when Insert into Table is selected.

Practical Examples

Reading Gmail Emails

Example

You want to use the Email IMAP/OAuth2 node to read emails from the following Gmail account, then extract the number string contained in the message

imap

You configure the node as follows:

Because the user wants to read mail in Gmail, the user will choose the Gmail service, then the user fills in the Email box of the account he wants to read. Next, in Password, here the user will not use the account password but the user needs to fill in the App Password value of the account.

First, you need to enable the 2-Step Verification feature in your Google account to be able to create an App Password

imap

Next, to create an App Password, access the page https://myaccount.google.com/apppasswords then select App Name then press Create as shown in the picture. After creating, the user fills that value in the Password box

imapimapimap

Open Advanced filters and specify the INBOX mailbox to retrieve emails from. You select Select only unread emails to read the latest emails. For Read Emails from (n Minutes) Ago, you set it to 10 minutes. To ensure, you read emails from a specific sender, you enter their address in Select only unread emails. You configure the regex as \d+ to extract only numbers from the email. After retrieving the text, you assign it to a variable named mail for later use. The node configuration looks like this:

imapimap

When running the node, you successfully retrieve the desired text

imap

Reading Outlook Emails

Example

You want to use the Email IMAP/OAuth2 node to read emails from the following Outlook account:

imap

You configure the node as follows:

Since you want to read emails from Outlook, you select the Outlook/Hotmail service and enter the account email in the Email field. Then, you enter the clientId in the ClientId field and the refreshToken in the RefreshToken field.

Next, you open Advanced Email Filtering and select the mailbox to read from. Here you want to read from the INBOX, so you enter INBOX. You select Select only unread emails to read the latest emails. For Read Emails Within (x Minutes) Ago, you set it to 50,000 minutes since the latest email is from April 13. You configure the regex as \d+ to extract only numbers from the email. After retrieving the text, you assign it to a variable named mail for later use. The node configuration looks like this:

imapimap

When running the node, you successfully retrieve the desired text:

imap

Here’s the English translation with all links kept unchanged:


Custom Email Reading

Example

If a user wants to read emails from an account on https://mail.one.com/, they need to configure a custom Email IMAP/OAuth2 node as follows:

First, since this email provider is not available by default, you need to choose Custom under Email provider, then configure the IMAP Host as imap.one.com, while the other values can remain unchanged.

imap

Next, enter the Email and Password as shown:

imap

Then, configure the Advanced filter to customize how emails are read. To read emails from the Inbox, set the Folder accordingly, and select Select only unread emails to fetch only unread emails. Since the exact time of the latest incoming email is unknown, you should set a sufficiently long time in the Read email from (n minutes) ago field. To filter out spam, configure Sender address contains.

imap

Next, if the user wants to extract links contained in the email, configure the Regex extract data. The Timeout (second) allows more time for the node to run in case there are multiple customizations applied to the email. To avoid reading the same email again, enable Mark as read. Finally, assign the extracted result to variable a in the Assign to variable field.

imap

At this point, the node’s output will be a link, for example:

imap