Email Read IMAP Node works sometimes

Hi Everyone,

I have set up the ‘Email Read IMAP’ node to ‘watch’ an office 365 folder for incoming emails. About 50% of the time when a new email comes in the node triggers correctly and the new email is marked as read which is fine. But the other 50% of the time the node does not trigger and the emails remain marked as unread.

To rectify this I then deactivate and then re-activate the workflow and the emails are marked as read and the node triggers correctly.

Could someone please suggest what might be going on please?

Thank you!

Paul

Sadly not. Do you have any more information when that happens?

Like is it only a problem when n8n restarts or does it also happen when it is already running. If the later, does that normally then start to happen after a certain amount of time and if so how long around? Does it stop working after it got triggered by an email and then stops working or could can it also be the very first one? …?

Literally anything could be helpful to figure out what could be going wrong there.

Hi Jan,

I am using a vultr virtual server and n8n is running 24/7 and I would say adding fail2ban helped keep the server from crashing and at the same time we added n8n as a service so if a restart did take place n8n would be working straight away. Before those changes the server was crashing about once a day and needed to be restarted. I find the imap email node works for about a day at a time so could it be a server restart is causing the imap node to not pick up on the new emails. Does this help you at all?

Kind regards

Paul

Hey @Paul_Clarke,
From your last post, it is sounding like your n8n server may be under attack. fail2ban is a very good start but it’s focus is SSH. Your other ports are probably still wide open with limited security on them.

A few ideas to help you along:

  1. Set up a VPN or SSH tunnelling to the server to provide encrypted, limited access to the actual n8n installation
  2. Set up a firewall to limit and restrict access to only internal connection (127.0.0.1/localhost)
    • If using webhooks, limit access to the webhook to only the services that require the service. This can be done from the firewall based on specific IP ranges
  3. Disable ping responses from your server

I realize that none of these things are specifically n8n related but it is important to ensure that you server is safe first before moving on to troubleshooting specific services. Otherwise, you are battling every single person on the internet who decides they want to run the latest exploit tool against a range of addresses.

Hope this helps.

Hi there, shimming in as I am facing the same issue.

I use the IMAP node to connect to a G Suite account through their IMAP feature (disabled by default) and it works well if I receive an email soon after enabling the workflow. When I get an email a few days later, it doesn’t trigger until I turn it off then on again.

I can confirm my VM running n8n was not attacked or even rebooted, in fact the IMAP node worked well while our G Suite emails were still self-hosted on a Zimbra installation. This appears to be specific to actors like Google and certainly Microsoft, maybe there is a timeout on IMAP connections and n8n doesn’t automatically reconnect. I ignore if it uses the push IMAP feature or not, but if it’s waiting for a push while it’s really disconnected it won’t ever happen.

If there is a way I can provide relevant logs (nothing in the console afaik) let me know and I’ll try to contribute to the best of my abilities, the IMAP node is really helpful although not as advanced as Zapier’s or Huginn’s if we remain among self-hosted automation platforms.

Best regards,
Dylan