IMAP Trigger - Outlook Exchange ERROR: Login Failed

Im trying to use the IMAP trigger for my company Outlook Account.
When I try to run it get

ERROR: Login Failed

at Connection._resTagged (/usr/local/lib/node_modules/n8n/node_modules/imap/lib/Connection.js:1502:11)
    at Parser.<anonymous> (/usr/local/lib/node_modules/n8n/node_modules/imap/lib/Connection.js:194:10)
    at Parser.emit (node:events:526:28)
    at Parser._resTagged (/usr/local/lib/node_modules/n8n/node_modules/imap/lib/Parser.js:175:10)
    at Parser._parse (/usr/local/lib/node_modules/n8n/node_modules/imap/lib/Parser.js:139:16)
    at Parser._tryread (/usr/local/lib/node_modules/n8n/node_modules/imap/lib/Parser.js:82:15)
    at TLSSocket.Parser._cbReadable (/usr/local/lib/node_modules/n8n/node_modules/imap/lib/Parser.js:53:12)
    at TLSSocket.emit (node:events:526:28)
    at emitReadable_ (node:internal/streams/readable:578:12)
    at processTicksAndRejections (node:internal/process/task_queues:82:21)

I followed the docu for the setup.
As this is an organizational Outlook Account the suggested " How to solve the connection error when connecting to" does not apply.

I checked the Exchange IMAP settings for IMAP to enbaled.

The n8n version is 0.166.0 running on heroku.

Any Ideas how to fix my error?

Hi @Sebastian_Schumacher, did you enable IMAP for your user account?

This should be configurable in your Exchange console at Sign in to your account for each user:


If IMAP is enabled for your account, did you create an app password for your Microsoft 365 account? This should be possible via My Sign-Ins, though I think only if you’re not an administrator of your MS 365 account.

An alternative could be the use of the designated Outlook node instead of the generic IMAP node. I’ve quickly tested a workflow like this to fetch new emails and mark them as read:

The only downside is that you’ll need to run this workflow in intervals rather than using a purpose-built trigger. On the plus side, you won’t have to bother with IMAP authentication in MS365.

Let me know if you have any questions on this!

Thank you @MutedJam,
IMAP for my user account was already enabled - that wasnt the issue.
“My Sign-Ins” didnt help either as I could see the unsuccessful login attempt there, but had no further context.

What I’m using now is your proposed solution with the designated Outlook node. Thanks for pointing this out…

I suspect IMAP connections need a separate app password rather than your main Microsoft account password, so this could also be worth a shot.

But the designated Outlook node route is hopefully less painful :slight_smile: