An enhanced Email Trigger (IMAP) node that supports filtering by IMAP keywords (custom flags) — not just UNSEEN.
Currently the Email Trigger node (emailReadImap) can only filter by read/unread status. There is no UI option to filter by custom IMAP keywords like $Label1, $Processed, or n8n_done. This makes it impossible to build robust deduplication into email processing workflows without relying solely on read status or folder moves.
Proposed additions:
Has Keyword filter: Only trigger on emails that have a specific IMAP keyword
Does Not Have Keyword filter: Only trigger on emails that do NOT have a keyword (maps to IMAP UNKEYWORD)
Standard flag filters in the UI: Seen, Flagged, Answered, Deleted, Draft (currently only available via hidden customEmailConfig JSON)
My use case:
I run an automated email classification workflow on a Zimbra mail server:
Email Trigger (INBOX/n8n) → AI Classification → Set Custom Flag → Move to Folder
After processing, I set a custom IMAP keyword (e.g. n8n_done) on each email to mark it as handled. I need the trigger to skip emails that already have this keyword so they don’t get re-processed.
Currently there’s a workaround via “Custom Email Config” option:
[["UNSEEN"], ["!KEYWORD", "n8n_done"]]
But this requires knowledge of raw IMAP search syntax and the node-imap library’s array format — it’s not discoverable through the UI and most users wouldn’t know it exists.
A proper UI for keyword filtering would make email automation workflows significantly more reliable and accessible.
Any resources to support this?
RFC 3501 Section 2.3.2 — IMAP keywords are defined as user-settable flags (atoms without \ prefix)
n8n-nodes-imap community node (50k+ installs) — has partial custom flag support in its action node (v2.15.0, PR #104) but no trigger node
IMAP keywords are supported by all major mail servers: Dovecot, Cyrus, Gmail, Exchange, Zimbra (with limitations)
Are you willing to work on this?
I’m not a TypeScript developer myself, but I can provide detailed testing with Zimbra IMAP servers and help validate any implementation. I’ve already analyzed the current EmailReadImapV2.node.ts source and the underlying node-imap library — the SEARCH criteria support is already there, it just needs UI exposure.
Different names, same concept: metadata you can attach to an email to classify it.
Back to email workflows
In n8n, the IMAP Trigger is the standard way to automatically kick off a workflow whenever a new email arrives in a mailbox — it monitors the server for unread messages in real time.
Currently, the main criteria you can filter on are:
New emails
Unread emails
The consequence: in most cases, all emails in the inbox end up being processed by the workflow — whether they’re relevant or not.
What this feature request enables
With custom flag/keyword support directly in the IMAP trigger, you gain precise control over which emails enter your workflow and which ones get skipped.
Examples:
After an email has been checked and should stay in the inbox, set the tag n8n_done. On the next trigger run, all emails tagged n8n_done are simply ignored.
When a workflow starts processing an email, set the tag n8n_inprogress — so that any concurrent or subsequent execution of this (or another) workflow skips emails with that tag. Remove the tag once the workflow finishes.
I could go on with examples endlessly.
Why this matters
Emails can be processed much more selectively — irrelevant emails never even enter the workflow
Enables significantly more complex workflows with proper state management directly at the trigger level
Prevents duplicate processing across multiple workflows watching the same mailbox