IMAP Email Node Does Not Trigger Workflow

Describe the issue/error/question

I have tested the IMAP Email trigger node extensively and it does not trigger workflows.

For my latest test, I create an new email address (non-Gmail) which is not accessed by any other programs or workflows. New emails are marked as read, but the workflow is never executed.

Please share the workflow

{
  "nodes": [
    {
      "parameters": {
        "mailbox": "=INBOX",
        "format": "resolved",
        "options": {
          "customEmailConfig": "=[\"UNSEEN\"]",
          "allowUnauthorizedCerts": true,
          "forceReconnect": 60
        }
      },
      "name": "IMAP - Google Voice Missed Call",
      "type": "n8n-nodes-base.emailReadImap",
      "typeVersion": 1,
      "position": [
        -300,
        420
      ],
      "credentials": {
        "imap": {
          "id": "10",
          "name": "IMAP [email protected]"
        }
      }
    }
  ],
  "connections": {}
}```

## Information on your n8n setup
- **n8n version:** 0.183.0
- **Database you're using (default: SQLite):** SQLite
- **Running n8n via [Docker, npm, n8n.cloud, desktop app]:** Docker

Hey @MortgageRockstar,

I have just given your workflow a quick test with a GMX mailbox I have and it appears to have triggered.

Bit of data

If the emails are being marked as read and nothing else is on that mailbox it must be working, Have you enabled execution logging for your workflow?

What happens if you manually run it as well does that show everything working as it should?

Thanks for the quick response, @Jon .

The workflow executes (sort of*) when I click the Execute Workflow button (* when I first clicked the button, I get a spinning wheel which does not stop. If I stop that 1st execution and then click the button again, it works).

I have never used debugging for n8n. I tried adding the following environment values to my docker-compose.yml file (according to Logging - n8n Documentation), stopped and then restarted docker, but n8n then does not run at all.

N8N_LOG_LEVEL=debug
N8N_LOG_OUTPUT=console,file
N8N_LOG_FILE_LOCATION=/home/username/n8n/logs/n8n.log
N8N_LOG_FILE_MAXSIZE=50
N8N_LOG_FILE_MAXCOUNT=60

If you check the docker log does it give any messages? Normally you should see some kind of service start message.

Luckily though the logging I was referring to is in the UI of n8n, If you open the workflow settings you can tell it to keep the execution logs then on the left when you click on the execution list you would see if it has ran.

I am now curious though, If you are not using this process how do you know it has not ran your workflow? My initial thought is maybe your workflow is hitting an error which is why it appears it isn’t running but the execution log should show a bit more.

This page should show you around the execution log a bit: Activating and examining the workflow - n8n Documentation

Thanks for the additional information, @Jon .

The workflow runs without errors when triggered manually so an error in the workflow itself is not the issue.

The execution log does not show the workflow starting at all. However incoming emails to the mailbox are being marked as read.

As a further test, I just deactivated the workflow. The incoming email is now not being marked as read. In my opinion, it is an issue with the IMAP Email node marking emails as read when Action is set to “Mark as Read”, yet it is not not triggering the workflow.

By the way, I have been having this issue for some time now (IMAP Email Not Triggering with Gmail). I had multiple workflows using the IMAP Email node with the same Gmail email address and it was thought that one of them was marking the email as read and thus preventing the appropriate workflow from triggering. Now that I created a mailbox solely for this workflow, I know that is not the issue.

Hey @MortgageRockstar,

That is a bit odd, I would not rule out an issue in the workflow itself though as I have seen many workflows that are fine from the UI but when going live something unexpected happens with the data being recieved and it triggers an error.

Normally if you are not seeing an entry in the exeuction log assuming that the options are enabled it would suggest it has not found anything to run against and has stopped.

Maybe debug logging is the way forward, To see more there it will require you to set those options and try to start the service if it fails to run the docker log for the container should show an error that can help us work out what is going on.

Looking at your last reply on that thread I suspect what happened was the connection timed out and to get it working again it needs to be disabled and activated again, I suspect we will see that in the log which could be handy.

I use a couple of different workflows to monitor a Google Workplace inbox to route some emails to either other addresses or to make Slack Notifications and I have not yet hit this issue but I am aware of one other person who hits a timeout when using Google Mailboxes although this time you are using a non gmail mailbox so in theory you could have something different.

Thanks @Jon .

Again I do not believe there are any errors in the workflow that are causing this.

I conducted another test where I duplicated the workflow and deleted all nodes except the IMAP Email node. This new workflow triggered when it received an email.

So I decided to duplicate the entire workflow and, low and behold, the duplicated version of the workflow works. Very odd.

The only thing I could guess is that the IMAP email node of the original version of the workflow somehow got corrupted. I’ll be back in touch if the duplicated version of the workflow stops working again.

1 Like

Hey @MortgageRockstar,

When you duplicated the workflow did you copy / paste, export / import or make it again? I have not seen a node corrupt before as it is just stored as json data but I have seen an issue before if 2 nodes somehow manage to import with the same name.

If you have the export for the flow that doesn’t work I can quickly check to see if that is the case.

Hi again, @Jon .

I duplicated the workflow using the Duplicate option in the workflow menu.

snip

Unfortunately I deleted the workflow that wasn’t working properly after I duplicated so it is no longer available.

If it’s unlikely that the node could become corrupted, my next guess about this issue is that it may be related to needing to de-activate and re-activate the workflow whenever the IMAP credentials are changed. I changed the email address from a Gmail one to a non-Gmail one several times when I was testing and trying to get the IMAP Email node to trigger when an email was received.

1 Like

That could be it, I guess the best thing to do is keep an eye on it and if happens again we can have another poke.

Hi! I’m facing the exact same issue described here with the IMAP trigger. The mails are being marked open but the trigger doesn’t activate, neither n8n is logging any execution. Also using n8n v0.183.0.

I did what @MortgageRockstar suggested, duplicated the workflow, and deactivated the old one. The new one seems to work ok for now. I hope it will stay working, because this has stopped working suddenly, without any specific reason apparently.

@MortgageRockstar does your workflow is still running normally?

Hey @pbdco,

There was another thread opened recently and it looks like it has failed again, Currently waiting to see if there are any logs we can look at.

Check out my latest thread regarding this ongoing issue.

1 Like