Help With IMAP trigger

Describe the problem/error/question

What is the error message (if any)?

HIIII!!
I have a WorkFlow with an IMAP trigger but it seems to work for a while and then stop working. N8N version 2.4.6

Please share your workflow

Share the output returned by the last node

Information on your n8n setup

  • n8n version: 2.4.6
  • Database (default: SQLite):
  • n8n EXECUTIONS_PROCESS setting (default: own, main):
  • Running n8n via (Docker, npm, n8n cloud, desktop app): I mean i’ts a Docker
  • Operating system: I’m not sure, in my desktop is windows 11 bit y Don’t know where is the server
1 Like

Hi @Jesica_Gomez_Garcia Welcome!

If you are using Email Trigger to access gmail, please consider using dedicated GMAIL triggers, and for this just refresh your credentials and make sure they are listening to new emails, let me know what works.

Hi @Jesica_Gomez_Garcia ,

You are using JavaScript’s toLocaleString() to generate a date for the IMAP SINCE query.

  1. Invalid Format: IMAP servers are extremely strict. They require dates in the format DD-Mon-YYYY (e.g., 09-Feb-2026). Your code sends something like 9/2/2026 15:30:00 (depending on the Spanish locale), which causes the IMAP server to reject the command or drop the connection after a few attempts.

  2. Granularity: The IMAP SINCE command only supports Dates, not Times. You cannot ask the server for “emails from the last 2 minutes” using standard IMAP queries; you can only ask for “emails since today.”

The Solution:

You should rely on the UNSEEN flag and n8n’s internal tracking (if using the Trigger node) or simply fetch unread emails and process them.

Step 1: Fix the Custom Config

Open your Email Trigger (IMAP) node and change the Custom Email Config to just this:

["UNSEEN"]

Why?

  • This forces the node to only pick up emails marked as “Unread”.

  • It removes the broken date logic that is crashing the connection.

  • If you absolutely need the SINCE filter (e.g., to ignore old unread emails), use this valid n8n expression instead:

    =["UNSEEN", ["SINCE", "{{ $now.toFormat('dd-MMM-yyyy') }}"]]

Step 2: Verify Your Node Type

I noticed in your JSON that the node type is n8n-nodes-base.emailReadImap.

  • If you want this to run automatically: You must use the node explicitly named IMAP Trigger (the green trigger node).

  • If you are using the “Read Email” node: This node is an Action. It does not run by itself. You would need to add a Schedule Trigger node before it (e.g., set to run every 1 minute) to make it check for emails repeatedly.

If you are using the actual IMAP Trigger node and the JSON just looks weird, Step 1 (fixing the date format) is the solution.

Best regards,