Imap login failed for exchange server

Hi team,
I have been working with IMAP node since while.
But I’m facing a strange scenario now while configuring in production.

I’m able to connect using a certain user but using another account i got a login error.
I’m not sure if this problem is related to the user because i can login with the problematic user using another application.

Is your n8n site use ssl (https)? Iff not, try use it with n8n site!

hi @huuich .
Thanks for helping.
Didn’t configure https on my n8n yet .
How does n8n SSL can impact on login failed on outlook imap connection?
As i said it works with another user.

Hey @hermanmaleiane!

Did you check the steps mentioned in the credential documentation of the IMAP Email node? Did you follow those steps?

Hi @harshil1712
Thanks for helping.
Yes i followed the steps.
Please take a look to the below screenshot.
The user need to exist on https://account.live.com/ ?
This is an local user. Created on active directory and outlook.
Please clarify for me this.

During the tests my users doesn’t needed to be created there.

Hey @hermanmaleiane! If you have created an Outlook account, I don’t think you need to create another account on account.live.com. I don’t know why you’re facing this issue. This is more of a Microsoft question than n8n.

Microsoft has a security feature that doesn’t allow you to directly connect any external services. You need to follow the steps mentioned in the FAQ section to overcome that. You might have to search for an alternate solution if this doesn’t work. But I can assure you that the node is working fine, and the issue is from Microsoft’s end.

Hi @all.

Maybe i put my issue in the wrong way.
Actually i need to connect it to exchange server.
I’m able to get it work with some accounts and not working for other accounts.
Definitely it’s not a problem with the node because i made a Proof of concept using the same lib that n8n uses. Imap simple, and i got the same output.

@krynble any tip?

var imaps = require(‘imap-simple’);

var config = {

imap: {

    user: 'test',

    password: 'test',

    host: 'mail.xyx.xy',

    port: 993,

    tls: true,

    authTimeout: 3000

}

};

imaps.connect(config).then(function (connection) {

return connection.openBox('INBOX').then(function () {

    var searchCriteria = [

        'UNSEEN'

    ];

    var fetchOptions = {

        bodies: ['HEADER', 'TEXT'],

        markSeen: false

    };

    return connection.search(searchCriteria, fetchOptions).then(function (results) {

        var subjects = results.map(function (res) {

            return res.parts.filter(function (part) {

                return part.which === 'HEADER';

            })[0].body.subject[0];

        });

        console.log(subjects);

        // =>

        //   [ 'Hey Chad, long time no see!',

        //     'Your amazon.com monthly statement',

        //     'Hacker Newsletter Issue #445' ]

    });

});

});

Logs

Error: LOGIN failed.
at Connection._resTagged (C:\local\thehive\n8n-bug\node_modules\imap\lib\Connection.js:1502:11)
at Parser. (C:\local\thehive\n8n-bug\node_modules\imap\lib\Connection.js:194:10)
at Parser.emit (events.js:315:20)
at Parser._resTagged (C:\local\thehive\n8n-bug\node_modules\imap\lib\Parser.js:175:10)
at Parser._parse (C:\local\thehive\n8n-bug\node_modules\imap\lib\Parser.js:139:16)
at Parser._tryread (C:\local\thehive\n8n-bug\node_modules\imap\lib\Parser.js:82:15)
at TLSSocket.Parser.cbReadable (C:\local\thehive\n8n-bug\node_modules\imap\lib\Parser.js:53:12)
at TLSSocket.emit (events.js:315:20)
at emitReadable
(internal/streams/readable.js:569:12)
at processTicksAndRejections (internal/process/task_queues.js:79:21)

Hi @hermanmaleiane

My first suggestion would be to try and get the imap to work - doesn’t have to be on n8n.

Try to set up imap on Microsoft Outlook or a similar client, just to see what the correct credentials would look like. This also helps you make sure that IMAP is working fine on the server.

I would also recommend you to check if imap is enabled correctly on your exchange server and if you don’t have to use specific login credentials, such as “app passwords” used by Gmail and Yahoo.

Let me know if you get any updates or need further assistance!