Mailbox (IMAP) Trigger
AI-generatedSummary
Listen to an IMAP folder with IDLE and emit a normalized item for each new message. Optionally filter messages by thread position, include matching thread history, download attachments, mark fetched messages as seen, and reconnect periodically.
Inputs
- Mailbox (required) — IMAP folder to watch; defaults to INBOX.
- Mark as Seen — Defaults to false. When enabled, adds the \Seen flag to each emitted message; flagging errors are ignored.
- Download Attachments — Defaults to false. When enabled, adds parsed attachments as binary fields named attachment_0, attachment_1, and so on.
- Force Reconnect Every (Minutes) — Defaults to 29 minutes. A positive value schedules periodic reconnection; zero or less disables the timer.
- Skip Initial Backlog — Defaults to true. On the first start, records the mailbox's next UID and waits for new arrivals; when disabled, the initial fetch processes existing messages.
- Thread Filter Mode — Defaults to All Messages. New Threads Only emits messages with neither In-Reply-To nor References; Replies Only emits messages with either header.
- Include Thread History — Defaults to false. Adds a thread array, threadCount, and formatted threadHistory string to each emitted message. When enabled, matching messages are searched in the configured folders, or by default in the watched folder and any detected Sent folder.
- Thread Search Folders — Shown when Include Thread History is enabled. Comma or semicolon separated folder names to search; an empty value uses the watched folder and any detected Sent folder.
- Thread History Limit — Shown when Include Thread History is enabled. Defaults to 20; keeps the most recent messages when the fetched thread exceeds this limit.
- Include Thread Bodies — Shown when Include Thread History is enabled. Defaults to true; when disabled, history entries contain envelope data without message bodies.
Output shape
Emits one n8n item per processed new message, with a JSON object and optional binary attachment data.
The JSON includes UID, mailbox, message/thread headers, subject, normalized sender and recipient addresses, date, HTML and text bodies, headers, and flags. With thread history enabled, it also includes thread entries, their count, and a formatted history string. The trigger requires mailboxApi credentials and keeps listening until closed.