Reputation: 57
I am trying to connect Imap in the localhost, but getting a debug log as below, but the username and passwords are correct. I am able to connect through web interface with the login credentials.
<= '* CAPABILITY IMAP4 IMAP4rev1 AUTH=PLAIN AUTH=XOAUTH2 SASL-IR UIDPLUS ID UNSELECT CHILDREN IDLE NAMESPACE LITERAL+'
<= 'A0 OK CAPABILITY completed.'
=> 'A1 LOGIN "************@*****.com" "**************"'
<= 'A1 NO LOGIN failed.'
[connection] Ended
[connection] Closed
[connection] Connected to host
<= '* OK The Microsoft Exchange IMAP4 service is ready. [TQBBAFgAUABSADAAMQAwADEAQwBBADAAMAAyADcALgBJAE4ARABQAFIARAAwADEALgBQAFIATwBEAC4ATwBVAFQATABPAE8ASwAuAEMATwBNAA==]'
=> 'A0 CAPABILITY'
<= '* CAPABILITY IMAP4 IMAP4rev1 AUTH=PLAIN AUTH=XOAUTH2 SASL-IR UIDPLUS ID UNSELECT CHILDREN IDLE NAMESPACE LITERAL+'
<= 'A0 OK CAPABILITY completed.'
=> 'A1 LOGIN "************@*****.com" "**************"'
<= 'A1 NO LOGIN failed.'
Please anyone help me to resolve this, i checked the complete world of stackoverflow, but nobody couldnt fix this. I appreciate if anyone has the solution.
export const imapConfig = {
imap: {
user: process.env.OUTLOOK_USER,
password: '',
host: process.env.OUTLOOK_HOST,
port: Number(process.env.OUTLOOK_PORT || 993),
tls: true,
authTimeout: 25000,
connTimeout: 30000,
keepalive: true,
secure: true,
debug: console.log
tlsOptions: {
rejectUnauthorized: false
servername: process.env.OUTLOOK_HOST
host: process.env.OUTLOOK_HOST
}
}
}
Upvotes: 2
Views: 4097
Reputation: 33
If you are trying to access outlook emails using imap with basic authentication, so this is now not possible because Microsoft had disabled or depricated the access of outlook emails using username and password. But you can still access emails using imap through username and oauth token.Here is the link given below for better understanding.
https://www.limilabs.com/blog/oauth2-client-credential-flow-office365-exchange-imap-pop3-smtp
Upvotes: 1