rest-api-nodejs-mongodb
rest-api-nodejs-mongodb copied to clipboard
Does not work with Google SMTP
Hi,
I have enabled SMTP on GMAIL and trying to use this code but getting this error while using the following API http://localhost:3000/api/auth/register
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 c4-c35345.73 - gsmtp
{
"status": 0,
"message": {
"code": "EAUTH",
"response": "535-5.7.8 Username and Password not accepted. Learn more at\n535 5.7.8 https://support.google.com/mail/?p=BadCredentials b29-c34543- gsmtp",
"responseCode": 535,
"command": "AUTH PLAIN"
}
}
EMAIL_SMTP_HOST=smtp.gmail.com
EMAIL_SMTP_PORT=465
EMAIL_SMTP_USERNAME=tried both email id and only account name
EMAIL_SMTP_PASSWORD=password goes here
# true for 465, false for other ports
EMAIL_SMTP_SECURE=true
Any idea on how to fix this.
Hi @nitinmukesh I also had the same error a while ago. I did a quick fix for it. First make your account a secure account by turning on two factor authentication. Then visit - https://myaccount.google.com/security?hl=en and check for app password. Set your app password for mail service , device as custom and then use the password generated there here in EMAIL_SMTP_PASSWORD.
Then again run the app. Hope that will work for you.