Reference · Tools

Email Read (IMAP)

Connect to an IMAP email server, fetch messages matching search criteria, and optionally download attachments as binary data.

Action (binary) Communication v1 Binary data

Email Read (IMAP) connects to an IMAP mail server, fetches messages that match search criteria you define, and outputs one item per email with parsed fields like sender, subject, date, and body. Attachments are saved as binary properties you can pass directly to downstream nodes. A typical use is polling an orders inbox, extracting invoice PDFs, and routing them into a document processing workflow.

Node type
Action (binary)
Parameters
9
Outputs
Output, Error
Credentials
IMAP

Email Read (IMAP)

Fetch emails from IMAP server and download attachments

Overview

The Email Read IMAP tool connects to an IMAP email server using provided credentials, fetches messages matching configurable search criteria (UNSEEN, ALL, FLAGGED, custom rules), and outputs one item per email with parsed metadata (from, to, subject, date, body). Supports three output formats: simple (structured fields), resolved (full parsed message), and raw (unprocessed body text). When download attachments is enabled (or format is resolved), email attachments are saved as separate binary properties (attachment_0, attachment_1, etc.).

Category: Communication
Tool Name: email_read_imap
Version: 1

Appearance: Icon: lucide-MailOpen | Color: #44AA22

Node Type

Action (Binary) — handles file/binary data operations

Input / Output

DirectionPort(s)
InputInput
OutputOutput, Error

Credentials

This tool requires IMAP credentials. See the Credentials Guide for setup instructions.

Parameters

ParameterTypeRequiredDefaultDescription
MailboxstringNoINBOXThe IMAP mailbox/folder to read emails from (e.g., INBOX, Sent, Drafts, or a custom folder). Supports expressions.
FormatoptionsNosimpleThe format to return email messages in.
Options: simple (structured output with parsed text, headers, and optional attachments), resolved (full email parsed with all data resolved and attachments always saved as binary data), raw (raw email body text without parsing — no attachments)
Search CriteriastringNo["UNSEEN"]IMAP search criteria as a JSON array. Examples: [“UNSEEN”], [“ALL”], [[“FROM”,“user@example.com”]], [[“SUBJECT”,“invoice”], “UNSEEN”], [[“SINCE”,“01-Jan-2025”]]. Multiple criteria are ANDed together. Supports expressions.
Download AttachmentsbooleanNofalseWhether to download email attachments as binary data. Only applies when Format is Simple. Resolved format always downloads attachments. (shown when Format is simple)
Attachment Property Prefix (binaryPropertyName)stringNoattachment_Prefix for binary property names of downloaded attachments. An index starting at 0 is appended (e.g., attachment_0, attachment_1). Names are case-sensitive. (shown when Format is resolved)
Attachment Property Prefix (binaryPropertyName)stringNoattachment_Prefix for binary property names of downloaded attachments. An index starting at 0 is appended (e.g., attachment_0, attachment_1). Names are case-sensitive. (shown when Format is simple and Download Attachments is true)
Mark as ReadbooleanNotrueWhether to mark fetched emails as read (add \Seen flag) after processing.
LimitnumberNo50Maximum number of emails to fetch per input item. Set to 0 for unlimited.
Max ConcurrencynumberNo1Maximum number of input items to process concurrently. Keep low since each item opens an IMAP connection.

Output Data

Each input item triggers one mailbox fetch and fans out to one output item per email found. The email replaces the item JSON — upstream fields are not merged in — and every output item carries a _emailReadImap property describing its position in the fetch:

{
  "_emailReadImap": {
    "emailIndex": 0,
    "emailCount": 12,
    "mailbox": "INBOX"
  }
}

When no email matches the search criteria, the input item passes through unchanged with _emailReadImap set to { "emailCount": 0, "mailbox": "INBOX" }, so an empty mailbox never silently drops the branch.

The rest of the JSON depends on Format:

FormatFields on the output item
simplefrom, to, cc, date, subject, textPlain, textHtml, metadata (every header other than from/to/cc/date/subject), attributes.uid
resolvedfrom, to, cc, bcc, subject, date (ISO 8601), messageId, inReplyTo, references, html, text, textAsHtml, headers (all header lines keyed by name), attributes.uid
rawraw (the unparsed message source) and uid

Attachments are written as binary properties named with the Attachment Property Prefix plus a zero-based index — attachment_0, attachment_1, and so on — each keeping the original file name and MIME type. Binary data arriving on the input item is merged through alongside them. resolved always downloads attachments; simple only does so when Download Attachments is on; raw never does.

Reference an email downstream by expression, e.g. {{ $json.subject }} or {{ $json._emailReadImap.emailCount }}.

Usage Examples

  • Read unread emails from INBOX
  • Fetch emails from a specific sender
  • Download email attachments as binary data
  • Read all flagged emails from a custom folder
  • Get emails with subject containing “invoice”

Example Configuration

Fetch unread emails and mark them read:

{
  "type": "email_read_imap",
  "parameters": {
    "mailbox": "INBOX",
    "format": "simple",
    "searchCriteria": "[\"UNSEEN\"]",
    "markAsRead": true,
    "limit": 50
  }
}

Fetch all emails from a specific sender without changing their read state:

{
  "type": "email_read_imap",
  "parameters": {
    "mailbox": "INBOX",
    "format": "simple",
    "searchCriteria": "[[\"FROM\",\"sender@example.com\"]]",
    "markAsRead": false,
    "limit": 10
  }
}

Simple format with attachment download under a custom prefix:

{
  "type": "email_read_imap",
  "parameters": {
    "mailbox": "INBOX",
    "format": "simple",
    "searchCriteria": "[\"UNSEEN\"]",
    "downloadAttachments": true,
    "binaryPropertyName": "email_attachment",
    "markAsRead": true,
    "limit": 25
  }
}

Resolved format, which parses the whole message and always saves attachments:

{
  "type": "email_read_imap",
  "parameters": {
    "mailbox": "INBOX",
    "format": "resolved",
    "searchCriteria": "[\"ALL\"]",
    "binaryPropertyName": "attachment",
    "markAsRead": true,
    "limit": 100
  }
}

Raw format for downstream text processing, reading a non-default folder with no limit:

{
  "type": "email_read_imap",
  "parameters": {
    "mailbox": "Sent",
    "format": "raw",
    "searchCriteria": "[[\"SINCE\",\"01-Jan-2025\"]]",
    "markAsRead": false,
    "limit": 0
  }
}

Compound search criteria — unread invoices only:

{
  "type": "email_read_imap",
  "parameters": {
    "mailbox": "INBOX",
    "format": "simple",
    "searchCriteria": "[[\"SUBJECT\",\"invoice\"], \"UNSEEN\"]",
    "downloadAttachments": true,
    "binaryPropertyName": "invoice_attachment",
    "markAsRead": true,
    "limit": 20
  }
}

Historical search combining a sender and a date range:

{
  "type": "email_read_imap",
  "parameters": {
    "mailbox": "INBOX",
    "format": "simple",
    "searchCriteria": "[[\"FROM\",\"reports@company.com\"], [\"SINCE\",\"01-Dec-2024\"]]",
    "markAsRead": false,
    "limit": 0
  }
}

Error Handling

ModeBehavior
stopHalts workflow on first error
continueSkips failed items, passes successful ones through
errorPortRoutes failed items to Error output port

Tips

Connect to an IMAP email server, fetch messages matching search criteria, and download attachments as binary data.

Choosing a format

  • simple gives you the fields most workflows need — sender, recipients, subject, date, plain-text and HTML bodies — with attachments optional. Start here.
  • resolved parses the entire message, including bcc, messageId, inReplyTo, references and every header line, and always downloads attachments. Use it for threading, auditing, or when you need a header the simple format folds into metadata.
  • raw returns the message source untouched and never downloads attachments. Use it for custom parsing or text analysis.

Notes

  • Search criteria must be valid JSON. Wrap the array in a string, escaping the inner quotes — "[\"UNSEEN\"]". Multiple criteria are ANDed together; each nested array is a key/value pair such as ["FROM","user@example.com"].
  • Mark as Read runs after the fetch. With it on, the same emails are not returned by a later ["UNSEEN"] run — that is what makes an unread-mailbox poll idempotent. Turn it off when you only want to inspect a mailbox.
  • One node run can produce many items. Set Limit to bound the fan-out, or 0 to take everything matching.
  • Keep Max Concurrency low. Each input item opens its own IMAP connection, and most mail servers cap simultaneous connections per account.
  • Attachment property names are case-sensitive. Downstream nodes must reference them exactly as {prefix}{index} — check the node’s Binary Data panel for the names produced by a run.
  • This node reads a mailbox on demand as part of a running workflow. To start a workflow when mail arrives, use the Email Trigger (IMAP) node instead.

Frequently asked questions

How do I write search criteria, and what syntax does this node expect?

Search criteria must be a JSON array encoded as a string with inner quotes escaped — for example, `"[\"UNSEEN\"]"` to fetch only unread messages. Multiple criteria are ANDed together, and key/value pairs like filtering by sender are written as nested arrays: `"[\"UNSEEN\",[\"FROM\",\"user@example.com\"]]"]`. Invalid JSON here will cause the node to error, so validate your string carefully before running.

What is the difference between the simple, resolved, and raw output formats?

`simple` returns the fields most workflows need — sender, recipients, subject, date, and plain-text and HTML bodies — with attachments optional. `resolved` parses the full message including `bcc`, `messageId`, `inReplyTo`, and all headers, and always downloads attachments regardless of your attachment setting. `raw` returns the unprocessed message source and never downloads attachments, making it suitable for custom parsing or text analysis.

If I run this node twice against the same mailbox, will I get duplicate emails?

That depends on whether Mark as Read is enabled. When it is on, the node marks fetched messages as read after retrieving them, so a subsequent run using `["UNSEEN"]` as the search criteria will skip those messages. When it is off, the same messages will be returned on every run. Turn Mark as Read on whenever you want idempotent inbox polling.

How do I reference email attachments in downstream nodes?

Attachments are stored as binary properties named by index — `attachment_0`, `attachment_1`, and so on — using a configurable prefix. These names are case-sensitive, so downstream nodes must reference them exactly as they appear in the Binary Data panel after a test run. The number of properties depends on how many attachments each email contains, so check the panel output rather than assuming a count.

This node is inside a workflow that receives many emails at once — will it overwhelm the mail server?

Each input item this node processes opens its own IMAP connection, and most mail servers enforce a cap on simultaneous connections per account. Keep Max Concurrency set to a low value to avoid hitting that limit. Also use the Limit parameter to bound how many messages a single run fetches, since setting it to `0` will attempt to pull every message matching your criteria in one go.

Build with the Email Read (IMAP) node

Drop it into a workflow, wire it to an agent, or call it on a schedule. You'll need IMAP credentials first.

Open BusyBot

Last updated . Spotted something wrong? Tell us.