The idea is:
Add an option to the IMAP credential (or the Email Trigger node) to disable IMAP4rev2, passed through to imapflow as disableIMAP4rev2: true. imapflow already supports this option and documents it as a “targeted opt-out for servers with broken IMAP4rev2 implementations”. n8n just doesn’t expose it.
My use case:
I forward PDF attachments from a Strato mailbox (imap.strato.de, a large German hosting provider) to Paperless-ngx with the Email Trigger (IMAP).
Since n8n 2.x the trigger uses imapflow, which sends ENABLE IMAP4rev2 whenever the server offers it. Strato’s server accepts this, but then answers every SEARCH with an empty result. The trigger is notified of new mail via IDLE, finds nothing, and fails silently: no execution, no error, the workflow shows as active.
C: 5 ENABLE CONDSTORE IMAP4REV2
S: * ENABLED CONDSTORE IMAP4rev2
C: 8 UID SEARCH UNSEEN
S: * ESEARCH (TAG "8") UID <- empty, although 15 messages are unseen
C: A UID SEARCH ALL
S: * ESEARCH (TAG "A") UID <- empty, although 21 messages exist
With disableIMAP4rev2: true the same server returns correct results (15 and 21 hits). The server bug is reported to Strato, but a fix there may take a long time.
I think it would be beneficial to add this because:
- Every n8n user with a Strato mailbox is affected, and probably users of other servers with a broken IMAP4rev2 implementation too.
- The failure is silent and very hard to diagnose. It took me several hours, debug logging and a protocol trace with imapflow to find the cause.
- The fix on the n8n side is small, because imapflow already has the option.
- The only workaround right now is to bind-mount a patched
@n8n/imap/dist/connection-options.jsinto the container. That breaks silently with every n8n update.
Any resources to support this?
- imapflow option
disableIMAP4rev2: GitHub - postalsys/imapflow: IMAP Client library for EmailEngine Email API (https://emailengine.app) · GitHub - My (auto-closed) issue with full details: Email Trigger (IMAP): finds no emails on servers with broken IMAP4rev2 — please expose imapflow's disableIMAP4rev2 · Issue #41344 · n8n-io/n8n · GitHub
- Debug log of the trigger:
New emails received in node "EmailReadImap" {"numEmails":1}
Querying for new messages on node "EmailReadImap" {"searchCriteria":["UNSEEN"]}
Process 0 new emails in node "EmailReadImap"
- Environment: n8n 2.43.7 self-hosted (Docker, PostgreSQL), imapflow 1.7.1
Are you willing to work on this?
No