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?
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.
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?
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:
Set up a VPN or SSH tunnelling to the server to provide encrypted, limited access to the actual n8n installation
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
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.
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.
I hate to have to say this, but the same is happening to me.
There’s clearly a problem with IMAP Read Email node, and it’s going to be really hard to debug.
As a first step, I would suggest to log any interruption in the imap connection. At least that, so that those who can manage logs, can create alerts to notify us and better identify the problem.
Ah yes, there is definitely something wrong with the IMAP node. We already tried to debug (mainly @krynble ) and like you also said is it not very easy. But it looks like the issue is the underlying library that the node uses. It does seem neither to reconnect when the connection gets interrupted nor does it send an event or some kind of error. Looks like at some point a rewrite is needed with a different library that does not have those issues.
Even I’ve been facing this issue and I’ve figured a small work around for this issue using n8n again.
I’ve setup another workflow which basically activates the workflow using the Cron trigger on a given time every day. I know this is not ideal, but this is atleast saving me time by not worrying about the emails not being read.