Aug 14, 2023

Need Help with "Invalid login: 535-5.7.8 Username and Password not accepted" Error in Nodemailer He

Error sending email: Error: Invalid login: 535-5.7.8 Username and Password not accepted. Learn more at
535 5.7.8  https://support.google.com/mail/?p=BadCredentials a14-20020aa780ce000000b0064fa2fdfa9esm8326635pfn.81 - gsmtp

I'm using Nodemailer to send emails for a password reset feature in my application. The error suggests that my credentials are not being accepted for authentication, but I'm sure the credentials are correct.
Here's some additional information:
  • I'm using a Gmail account to send emails.
I've also checked the following:
  • The process.env.SMTP_EMAIL and process.env.SMTP_PASSWORD values are correct.
  • I've tried enabling access for "Less Secure Apps" temporarily, but the error persists.
  • My network connectivity is fine, and I can access external resources.
Could anyone help me troubleshoot and resolve this issue? Is there anything specific I should configure differently when using Nodemailer with Gmail's enhanced security features? Any insights or suggestions would be greatly appreciated.
Thank you for your time and assistance!
Best regards, [Shoppie]
Locked
Informational notification.
This question is locked and replying has been disabled.
Community content may not be verified or up-to-date. Learn more.
Recommended Answer
Aug 14, 2023
Original Poster shoaib Hasan marked this as an answer
Helpful?
All Replies
Aug 14, 2023
You need to use OAuth2 authentication, or, if that is not an option, you need to use an App Password.
Aug 14, 2023
How can I create app password 
Recommended Answer
Aug 14, 2023
Original Poster shoaib Hasan marked this as an answer
false
16854572954709177825
true
Search Help Center
true
true
true
true
true
17
Search
Clear search
Close search
Main menu
false
false