Office 365 SMTP authentication
See original GitHub issue⚠️ Please verify that this bug has NOT been raised before.
- I checked and didn’t find similar issue
🛡️ Security Policy
- I agree to have read this project Security Policy
Description
Upon creating a Mail Notification and using Office 365 i run in following Error:
Error: Invalid login: 535 5.7.139 Authentication unsuccessful, the request did not meet the criteria to be authenticated successfully. Contact your administrator. [AM6P193CA0093.EURP193.PROD.OUTLOOK.COM] at SMTPConnection._formatError (/app/node_modules/nodemailer/lib/smtp-connection/index.js:784:19) at SMTPConnection._actionAUTHComplete (/app/node_modules/nodemailer/lib/smtp-connection/index.js:1536:34) at SMTPConnection.<anonymous> (/app/node_modules/nodemailer/lib/smtp-connection/index.js:1490:18) at SMTPConnection._processResponse (/app/node_modules/nodemailer/lib/smtp-connection/index.js:947:20) at SMTPConnection._onData (/app/node_modules/nodemailer/lib/smtp-connection/index.js:749:14) at TLSSocket.SMTPConnection._onSocketData (/app/node_modules/nodemailer/lib/smtp-connection/index.js:189:44) at TLSSocket.emit (node:events:527:28) at addChunk (node:internal/streams/readable:315:12) at readableAddChunk (node:internal/streams/readable:289:9) at TLSSocket.Readable.push (node:internal/streams/readable:228:10) { code: 'EAUTH', response: '535 5.7.139 Authentication unsuccessful, the request did not meet the criteria to be authenticated successfully. Contact your administrator. [AM6P193CA0093.EURP193.PROD.OUTLOOK.COM]', responseCode: 535, command: 'AUTH LOGIN' }

👟 Reproduction steps
Create New Notification Enter Office 365 Credentials Test
👀 Expected behavior
Sending a E-Mail
😓 Actual Behavior
Runs in an authentication error
🐻 Uptime-Kuma Version
1.16.1
💻 Operating System and Arch
linux x86_64 Debian GNU/Linux 11 (bullseye)
🌐 Browser
Google Chrome Version 102.0.5005.62
🐋 Docker Version
20.10.12 (API: 1.41)
🟩 NodeJS Version
No response
📝 Relevant log output
Error: Invalid login: 535 5.7.139 Authentication unsuccessful, the request did not meet the criteria to be authenticated successfully. Contact your administrator. [AM6P193CA0093.EURP193.PROD.OUTLOOK.COM]
at SMTPConnection._formatError (/app/node_modules/nodemailer/lib/smtp-connection/index.js:784:19)
at SMTPConnection._actionAUTHComplete (/app/node_modules/nodemailer/lib/smtp-connection/index.js:1536:34)
at SMTPConnection.<anonymous> (/app/node_modules/nodemailer/lib/smtp-connection/index.js:1490:18)
at SMTPConnection._processResponse (/app/node_modules/nodemailer/lib/smtp-connection/index.js:947:20)
at SMTPConnection._onData (/app/node_modules/nodemailer/lib/smtp-connection/index.js:749:14)
at TLSSocket.SMTPConnection._onSocketData (/app/node_modules/nodemailer/lib/smtp-connection/index.js:189:44)
at TLSSocket.emit (node:events:527:28)
at addChunk (node:internal/streams/readable:315:12)
at readableAddChunk (node:internal/streams/readable:289:9)
at TLSSocket.Readable.push (node:internal/streams/readable:228:10) {
code: 'EAUTH',
response: '535 5.7.139 Authentication unsuccessful, the request did not meet the criteria to be authenticated successfully. Contact your administrator. [AM6P193CA0093.EURP193.PROD.OUTLOOK.COM]',
responseCode: 535,
command: 'AUTH LOGIN'
}
Issue Analytics
- State:
- Created a year ago
- Comments:8 (7 by maintainers)

Top Related StackOverflow Question
Ahh ok, so we would need to support a new method of authentication for microsoft email servers such as OAuth2. In which case, would it be possible to change this issue from a bug to a feature request for support for this. Anoyingly, OAuth will be more complicated to implement as it requires that we register the app with Azure Active directory. Microsoft have provided details on how to go about implementing this feature here, https://docs.microsoft.com/en-us/exchange/client-developer/legacy-protocols/how-to-authenticate-an-imap-pop-smtp-application-by-using-oauth. Due to the deadline of October 1, 2022 this should probably be fairly high priority as it will probably take a while to get the registration with Azure.
@louislam Sorry to ping you, as this requires registering with an external service, I think that that might be something that you would need to do. I could probably get the rest of it done this weekend or next weekend because I plan to finish off #1550 tomorrow (02/06/22)
Link to docs for nodemailer: https://nodemailer.com/smtp/oauth2/
Yeah, I can understand why they did it but it does seem like a really annoying step, especially when it is so easy with gmail (only need to enable smtp auth in settings)