Skip to content

Email IMAP/OAuth2

Retrieve the content of emails from Gmail, Yahoo, Hotmail, and other services.

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:

Since you want to read emails from Gmail, you select the Gmail service and enter the account email in the Email field. FFor the Password field, use an app password instead of the account password.

To create an app password, you visit https://myaccount.google.com/apppasswords, enter an App Name, and click Create as shown below. After creation, you enter the generated value into the Password field.

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