IMAP trigger skipping about 10% of the emails

Describe the problem/error/question

The IMAP email trigger in my workflow is not reliably triggering for each and every email received in the inbox.
About 10% of emails are being missed and this doesn’t seem to follow any precise pattern. It seems rather random.
I’ve tried changing the “Force Reconnect Every Minutes” and set it to even 1 min but it didn’t help.

What is the error message (if any)?

No error messages received.
Some emails received in the Gmail inbox are simply not triggering the workflow. We only have 1 inbox.

Information on your n8n setup

  • n8n version: 1.81.4
  • Running n8n via (Docker, npm, n8n cloud, desktop app): cloud
  • Operating system: Windows 11

Workflow trigger

The issue you’re experiencing happens because the IMAP trigger in n8n activates individually for each received email, processing them one at a time. This can cause some emails to be missed if they arrive quickly or in bursts, as n8n doesn’t process them simultaneously.

The Force Reconnect Every Minutes setting only refreshes the IMAP connection periodically but does not affect the ability to capture multiple emails at once.

If you want the workflow to trigger based on a time window (e.g., processing all emails received in the last 5 minutes), you’ll need to create a custom rule.

This way, instead of relying on the individual IMAP trigger, you’ll capture all unread emails within a given time frame, preventing any from being missed.

Thank you, @merarisosa - I’ve implemented almost the same formula but lowered the time to 2 mins:

["UNSEEN", ["SINCE", "{{new Date(new Date().getTime() - 2*60*1000).toLocaleString('en-US', {timeZone: 'America/Mexico_City' })}}"]]

During the last 4h the inbox received about 40 emails but still 3 got missed by the workflow trigger. No user marked these emails as read, so I cannot see any interferences there.

The workflow doesn’t show any error messages, so I’m a little confused as to what could possibly generate this issue.

Regarding the missed emails, it’s possible that the issue is caused by the 2-minute interval. Since the workflow only fetches emails from the last 2 minutes, messages received 4 hours ago might be skipped.

To troubleshoot further, I suggest marking the emails as read once they are processed. This way, you can track how the workflow handles the incoming emails and see if any are being missed by the trigger. It will also help you determine how many emails are actually being used in the process versus how many are detected as incoming.

Additionally, you could try forcing a reconnect at the same time the workflow triggers the email fetching process. This might help capture older emails that were previously missed.

1 Like

Ok, I’ve actually just found that there was an automation that was interfering with the IMAP trigger (it was marking all emails as read after 2 mins), so that is why some emails were not coming through.

Thanks again for your help @merarisosa - all solved now :grinning:

2 Likes

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.