n8n Email Trigger (IMAP): start a workflow on every incoming email
By Clément Lacaille (Tech-Bharat) · Published 3 August 2026 · updated 29 November 2026 · 13 min read · how we build and test
FlowKit Library — the English guides — €69
5 PDF guides in English in one ZIP · €115 bought separately · 14-day guarantee
The n8n Email Trigger (IMAP) node starts a workflow for each new email in an IMAP folder: you pick an IMAP credential (host, port 993, user, password), a Mailbox Name, an Action (None, or Mark as Read so the message isn't fetched again), whether to Download Attachments, and a Format (RAW, Resolved or Simple).
A webhook starts a workflow when an application calls you; the Schedule Trigger when the clock decides. But a huge share of the events worth automating arrive through a much older channel: email. A support request, a supplier invoice as an attachment, a job application, an order confirmed by a third party with no API — all of it lands in a mailbox and stays there until a human opens it. n8n's Email Trigger (IMAP) node turns that mailbox into a workflow entry point: every new message becomes an item, with its sender, subject, body and attachments, ready to be classified, extracted, forwarded or processed.
The phenomenon you're trying to contain has had a name for thirty years: "email overload," described by Steve Whittaker and Candace Sidner in their foundational study Email overload: exploring personal information management of email (CHI 1996, ACM). Their observation still holds: the inbox serves at once as a task queue, an archive and a communication channel — three functions no manual sorting can reconcile for long. That's exactly the argument for moving the sorting to the moment of arrival, automatically — which is what this guide sets up.

Email Trigger (IMAP), Gmail Trigger or Outlook Trigger?
n8n offers three ways to react to an incoming email. All three have a single event (an email received), but they don't reach the mailbox the same way:
| Email Trigger (IMAP) | Gmail Trigger | Microsoft Outlook Trigger | |
|---|---|---|---|
| Mailbox | Any provider that exposes IMAP | Gmail / Google Workspace | Outlook / Microsoft 365 |
| Authentication | User + password or app password | OAuth2 | OAuth2 (or Entra app-only) |
| How new mail is detected | Open connection, reacts when the server reports new mail | Polling at the interval set in Poll Times | Microsoft Graph API, event "Message Received" |
| Built-in filters | IMAP search criteria (Custom Email Rules), folder | Label Names, Search, Read Status, Sender, Include Spam and Trash | See the node's options |
| Writes back to the mailbox | Mark as Read only | Labels, drafts via the Gmail node | Via the Outlook node |
The comparison comes from the Email Trigger (IMAP), Gmail Trigger and Microsoft Outlook Trigger documentation pages and the IMAP node's source code, read on November 29, 2026.
The Gmail and Outlook triggers are tied to one provider and its proprietary API. They come with OAuth authentication. The IMAP trigger speaks IMAP, the standard protocol that virtually every mailbox in the world exposes: an address hosted at OVH or Infomaniak, an Outlook or Gmail mailbox, a self-hosted mail server, the email that comes bundled with your web hosting.
That's what makes it the trigger of choice for a small business's functional addresses — contact@, support@, invoices@, jobs@ — which rarely live with a single big provider and sometimes move along with the hosting plan. No application to register in a developer console, no OAuth consent to renew, no proprietary API quota: a host, a port, a username, a password, and the workflow fires on every new message.
Two reasonable exceptions to this preference: if your email lives entirely on Google, the Gmail node with its own trigger is often simpler to configure and richer in operations (labels, threads) — our Gmail connection guide covers that path. Same logic on the Microsoft 365 side, detailed in our Outlook / Microsoft 365 guide. IMAP remains the common denominator when the mailbox lives elsewhere, or when you want a setup that survives a change of provider.
Creating the IMAP credential
The credential asks for four pieces of information, all supplied by your mail host:
- Host: the provider's IMAP server —
ssl0.ovh.netat OVH,mail.infomaniak.comat Infomaniak,outlook.office365.comfor Outlook,imap.gmail.comfor Gmail. When in doubt, your provider's "set up a mail client" help page always lists these values. - Port:
993, the credential's default and the standard IMAP port over SSL/TLS, with the SSL/TLS option enabled. Only change it if your provider tells you to. - User: the full email address, in nearly every case.
- Password: the mailbox password — with one important nuance for the big providers.
The Gmail case. Google no longer accepts regular account passwords over IMAP. You need to check that IMAP is enabled in the Gmail settings on one hand, and create an app password on the other — which requires two-step verification to be active on the account. It's that app password, not the account password, that goes into the credential. If this gymnastics feels heavy, that's the sign you should use the native Gmail node instead: its dedicated trigger goes through OAuth and avoids all this configuration.
Once the credential is saved, the node's test button tells you immediately whether the connection works. An authentication error on an OVH or Infomaniak mailbox almost always comes from a mailbox-specific password (different from the customer account's) or from two-factor authentication requiring, there too, an app password.
The Email Trigger (IMAP) node's parameters
The node is short, but each of its settings has concrete consequences:
- Mailbox: the folder being watched,
INBOXby default. You can point it at any IMAP folder — and that's actually the best practice, as we'll see below: a dedicated folder (n8n,to-process) fed by a server-side filtering rule, rather than the entire inbox. - Post-read action: what the node does with a message once retrieved, typically marking it as read. This is the key behavior of the whole setup: a message marked as read no longer matches the retrieval rule and will therefore not be reprocessed on the next pass. Only disable this marking if you know exactly why.
- Download Attachments: when enabled, the node attaches every file in the message as binary data on the output item, named with a prefix (
attachment_by default:attachment_0,attachment_1…) — essential for processing PDF invoices or documents received by email. The documentation advises enabling it only when needed, since it increases processing. - Format: the official node documentation (read on October 21, 2026) lists three. Simple returns the full email with ready-to-use fields, but don't use it if you need inline attachments. Resolved returns the full email with all data resolved and attachments saved as binary data. RAW returns the whole message as a base64url-encoded string in the
rawfield, for when you want to parse headers yourself. - Custom Email Rules: the IMAP search criteria used to retrieve messages, written as JSON,
["UNSEEN"]by default — only unread messages. The syntax is that of the node-imap library (see the next section for examples). Since the node checks the JSON when the workflow is activated, a malformed rule fails right away rather than at the first email. - Force Reconnect Every Minutes: forces the IMAP connection to reopen at a set interval. In the current source code its tooltip says it isn't needed for reliability (the connection is monitored and re-established automatically) and is only useful for servers that enforce a maximum connection age.
- Fetch Only New Emails (node version 2.1 and later, on by default): the node remembers the UID of the last message it handled and only looks at newer ones; on first activation it starts from the activation date. Turn it off to fetch every message matching your rules again.
How the node actually works
Unlike a webhook that passively waits for a call, the node maintains a connection to the IMAP mailbox and checks for new messages matching its rule. As soon as a message matches — unread in the watched mailbox, with the default UNSEEN rule — the workflow runs with that message as input, then the node applies its post-read action (marking as read).
This behavior has a happy consequence: emails that arrived while the instance was down (restart, update, outage) are not lost. The source code explicitly runs a catch-up at activation, because mail that landed while the trigger was inactive sends no arrival event: those messages are still unread, so still eligible under the UNSEEN rule, and the trigger processes them. The queue is the mailbox itself. One nuance with Fetch Only New Emails (version 2.1+): a message you mark as unread again by hand won't be fetched a second time if its UID is older than the last one processed.
But the same mechanism creates this node's sneakiest trap: anything that marks a message as read makes it invisible to the trigger. Open the mailbox in a mail client on your phone, leave a webmail tab open displaying the messages, or let a colleague "take a quick look" at the support mailbox — and the messages viewed vanish from the trigger's scope with no error, no trace, no execution. The workflow appears to work; it just processes fewer and fewer messages. It's the first thing to check when "some emails don't trigger the workflow": who else reads this mailbox?

Filtering incoming emails before they start the workflow
Every message that reaches the trigger costs an execution, and often an AI call. Filter as early as possible, in this order:
- Server-side rule + dedicated folder (described below): the cheapest filter, it runs before n8n even sees the message.
- Custom Email Rules: IMAP search criteria evaluated by the mail server. They combine in one JSON array, every criterion must match, for example
["UNSEEN", ["FROM", "billing@supplier.com"]],["UNSEEN", ["SUBJECT", "invoice"]]or["UNSEEN", ["SINCE", "Nov 1, 2026"]]. KeepUNSEENin the array unless you have another way to avoid reprocessing. - A Filter or IF node right after the trigger, for conditions IMAP can't express (a domain list, a regular expression on the body). Our guide to the Filter node and the one on IF and Switch routing cover both. The workflow still runs for discarded emails, so keep this level for fine-tuning.
On Gmail, the Gmail Trigger offers the same idea with its own filters: Label Names, Search (Gmail search syntax), Read Status, Sender and Include Spam and Trash.
Using the output: classify, extract, decide
Every processed email becomes an item with the sender, the subject, the body in text and HTML, and the attachments as binary data if download is enabled. It's ideal raw material for AI workflows, because the whole value of automatic sorting lies in the nodes that follow:
- Classify the type of request: a Text Classifier node routes each message to the right branch — sales question, support request, invoice, spam — from the subject and body. Our Text Classifier guide covers category definitions and confidence thresholds.
- Extract data from invoices received as attachments: the PDF binary flows into a structured extraction chain (amount, supplier, due date), as in our guide to extracting data from PDF invoices with AI.
- Detect phishing before a human clicks: sender, links and phrasing go through a dedicated analysis — the full setup is in our guide to detecting phishing and spam with AI.
- Prepare a draft reply: for requests classified as simple, an LLM node writes a proposed reply that a human validates before sending.
Example: automatically sorting the support@ mailbox
The representative setup, described end to end:
- Email Trigger (IMAP) watches the
n8nfolder of thesupport@mailbox, fed by a server rule (see the next section). Simple format, mark as read, attachments enabled. - Text Classifier sorts each message into four categories:
urgent,product-question,billing,other. Each category prompt describes its case in one sentence with two examples. urgentbranch: a Slack node posts the message to the on-call channel with the sender and subject, tagging the person responsible.product-questionandbillingbranches: an HTTP Request node creates a ticket in the support tool with the right category pre-filled and the email body as the description.otherbranch: the message goes to a weekly review folder, with no notification.
The sold version is simpler, and here is exactly what its file contains: AI email sorting via IMAP watches INBOX with Mark as Read (change Mailbox Name to point it at your dedicated folder), keeps the sender, the subject and the first 4,000 characters of the body, has an LLM chain with a Structured Output Parser classify each email as urgent, client, administratif or newsletter, posts urgent ones to the Slack channel #inbox-ia and logs every email in a Supabase table emails_tries. You connect the IMAP, OpenAI, Slack and Supabase credentials; ticket creation is not included.
The robust pattern: dedicated address, dedicated folder
All the traps above (messages read by a human, double processing, shared INBOX) share the same structural solution:
- A dedicated address for the flow being automated (
invoices@,support@) rather than a personal mailbox where messages to process mix with human conversations. - A server-side filtering rule (a sieve or filtering rule at OVH, Infomaniak, Gmail or Outlook) that moves the messages to process into an
n8nfolder as soon as they arrive — by sender, by subject, or whatever matches the flow. - The trigger pointed at that folder, and nobody else reads it. Humans keep the INBOX; n8n has its folder; mark-as-read can no longer collide with a mail client.
This split has a secondary benefit: the server rule acts as a free first filter, before the workflow even runs. Newsletters and automated notifications never reach the n8n folder, so they consume neither an execution nor an AI model call.
Troubleshooting: the trigger doesn't fire
- It worked in the editor, then nothing. A test run ("execute step") listens until one email arrives, then stops. Continuous listening only starts once the workflow is published (activated); those executions then appear in the executions list, not in the editor.
- Authentication error. IMAP disabled at the provider, a mailbox password different from the customer-account password, or an app password required (Gmail, and accounts with two-step verification elsewhere). Test the credential before anything else.
- Some emails are skipped. Someone or something read them first (phone, webmail, a second workflow), or your Custom Email Rules exclude them. Check the rule JSON and who else opens the folder.
- "Custom email config is not valid JSON." The rule must be a JSON array with double quotes:
["UNSEEN"], not[UNSEEN]or['UNSEEN']. - The connection silently stops receiving. Some servers cap connection age: set Force Reconnect Every Minutes below that limit.
- No attachment in the next node. Download Attachments is off, or the next node reads the wrong binary property: look for
attachment_0in the trigger's output.
Common pitfalls
- Opening the watched mailbox in a mail client (phone, webmail) that marks messages as read: they become invisible to the trigger, with no error and no log. The classic symptom of the "workflow that misses emails."
- Watching INBOX on a shared mailbox instead of a dedicated folder fed by a server rule: guaranteed collisions between human sorting and automated sorting.
- Disabling mark-as-read with no other deduplication mechanism: the same messages remain eligible under the UNSEEN rule and can be reprocessed.
- Using the Google account password instead of an app password on Gmail: the IMAP connection will be refused. And if you're entirely on Google, the Gmail node is the simpler path anyway.
- Forgetting to enable attachment download and then hunting for the invoice PDF in the JSON: the files only exist as binary data if the option is enabled.
- Wiring two workflows to the same mailbox with the same rule: whichever marks the message as read first steals it from the other. Two separate folders, fed by two server rules, solve the problem cleanly.
- Choosing the RAW format without needing it: the base64url message requires manual parsing that Simple or Resolved make unnecessary in the vast majority of cases. And if you need inline images, use Resolved rather than Simple.
In summary
The Email Trigger (IMAP) node is the universal mailbox trigger: four credential fields (host, port 993, user, password), one folder to watch, and every email becomes a usable item with its subject, body and attachments. Its mechanics fit in one rule — retrieve unread messages, mark them as read after processing — from which flow both its robustness (emails that arrived during an outage are caught up) and its single real trap (any external read makes messages disappear). The dedicated address + server rule + n8n folder pattern neutralizes that trap once and for all. To go from the trigger to a working system, the Inbox AI Pack (€79) ships four ready-to-import workflows: AI sorting over IMAP (described above), urgency scoring, a daily digest to Slack and Telegram, and draft replies in Gmail.
FAQ
Frequently asked questions
Does n8n's Email Trigger (IMAP) node work with any mailbox?
Yes, that's precisely its point: IMAP is a standard protocol supported by virtually every provider — OVH, Infomaniak, Outlook, Gmail, a self-hosted mail server. All you need is the provider's IMAP host, port 993 (SSL/TLS), a username and a password. One nuance: for Gmail you must enable IMAP in the settings and create an app password (with two-step verification active), and Gmail's dedicated node with its own trigger is often simpler to set up.
What happens to emails that arrived while my n8n instance was down?
With the default rule based on UNSEEN, the trigger picks up at restart any messages still unread in the mailbox, including those that arrived during the outage. The essential condition: nothing else must have marked them as read in the meantime. A mail client open on the same mailbox (phone, webmail) that marks messages as read makes them invisible to the trigger — hence the recommendation of a dedicated address or folder that only n8n reads.
How do I prevent the same email from being processed twice by n8n?
Let the node mark messages as read after processing (the key behavior of the post-read action setting) and make sure no other process reads the same mailbox with the same rule. If two workflows must react to the same mailbox, have them read two separate folders fed by server-side filtering rules, rather than two triggers on INBOX fighting over the same messages.
Why is my n8n Email Trigger not firing?
Check three things in order. Is the workflow published? A test run ('execute step') only listens until one email arrives; continuous listening starts once the workflow is published. Is IMAP enabled at the provider, with an app password for Gmail or Outlook accounts that require one? And is the message really eligible: with the default ["UNSEEN"] rule, an email already opened on a phone or in webmail is skipped without any error.
What is the difference between the Email Trigger (IMAP) and the Gmail Trigger in n8n?
The Email Trigger (IMAP) keeps a connection open to any IMAP mailbox and reacts when the server reports new mail, authenticated with a username and password. The Gmail Trigger goes through the Gmail API with OAuth2 and polls at the interval set in Poll Times, with Gmail-specific filters (Label Names, Search, Read Status, Sender, Include Spam and Trash). Choose IMAP for mailboxes hosted outside Google, the Gmail Trigger if everything lives at Google.
How do I get the attachments of an incoming email in n8n?
Turn on Download Attachments in the Email Trigger (IMAP) node. Each file becomes a binary property named with the prefix set in the node, attachment_ by default: the first file is attachment_0, the second attachment_1, and so on. The next node (Extract from File, an AI chain, a storage upload) reads that binary property by name.