개발자 블로그
[Resolved] node mailer - Invalid login: Username and Password not accepted 본문
[Resolved] node mailer - Invalid login: Username and Password not accepted
로이드.Roid 2022. 7. 11. 14:27Translated by Google Translate.
In my app, I was receiving notifications by gmail using nodemailer for the part that needs monitoring. In the past, it was working fine without any problems, but at some point the mail was not being sent.
So I looked up the error log and found the following log. (It may be slightly different from the original text by deleting or modifying sensitive information.)
Send mail error: { Error: Invalid login: Username and Password not accepted. Learn more at
https://support.google.com/mail/?p=BadCredentials - gsmtp
at SMTPConnection._formatError (myprojects/node_modules/nodemailer/lib/smtp-connection/index.js:774:19)
at SMTPConnection._actionAUTHComplete (myprojects/node_modules/nodemailer/lib/smtp-connection/index.js:1513:34)
at SMTPConnection._responseActions.push.str (myprojects/node_modules/nodemailer/lib/smtp-connection/index.js:540:26)
at SMTPConnection._processResponse (myprojects/node_modules/nodemailer/lib/smtp-connection/index.js:932:20)
at SMTPConnection._onData (myprojects/node_modules/nodemailer/lib/smtp-connection/index.js:739:14)
at TLSSocket.SMTPConnection._onSocketData.chunk (myprojects/node_modules/nodemailer/lib/smtp-connection/index.js:189:44)
at emitOne (events.js:116:13)
at TLSSocket.emit (events.js:211:7)
at addChunk (_stream_readable.js:263:12)
at readableAddChunk (_stream_readable.js:250:11)
code: 'EAUTH',
response: 'Username and Password not accepted. Learn more at https://support.google.com/mail/?p=BadCredentials - gsmtp',
responseCode: 535,
command: 'AUTH PLAIN' }
The URL written in the log links to the page below.
https://support.google.com/mail/?p=BadCredentials
This page isn't really helpful. To put it simply, you have probably received an email from Google in the past. I also got the email and just ignored it.. :(
So Google actually already notified me... I just didn't do anything...
Well, what's important to us is how to solve it...
Fortunately, you can continue to use nodemailer using gmail if you set up a little.
- 2-Factor Authentication
- Create App Password
You only need to do these two things.
These settings can be changed from the link below.
https://myaccount.google.com/security
And if you need help with this, please refer to the link below.
https://support.google.com/accounts/answer/185833
If you have created an app password, you can change the password of the gmail account to the app password in the existing node.js code. And don't forget to restart the service!
'프로그래밍 > Node.js' 카테고리의 다른 글
node mailer - Invalid login: Username and Password not accepted 해결 (0) | 2022.07.11 |
---|---|
PROTOCOL_ENQUEUE_AFTER_FATAL_ERROR 에러 해결 (0) | 2021.12.21 |
이모티콘이 DB에 물음표(????)로 저장되는 현상 해결하기 (0) | 2021.01.15 |