Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Error: Invalid login: 535-5.7.8 Username and Password not accepted

The code below is perfect to send emails using node.js code/program. However, still getting error mentioned in the title.

var nodemailer = require('nodemailer');  var transporter = nodemailer.createTransport({   service: 'gmail',   auth: {     user: '[email protected]',     pass: '**********'   } });  var mailOptions = {   from: '[email protected]',   to: '[email protected]',   subject: 'Sending Email using Node.js',   text: 'That was easy!' };  transporter.sendMail(mailOptions, function(error, info){   if (error) {     console.log(error);   } else {     console.log('Email sent: ' + info.response);   } }); 
like image 880
Haider Yaqoob Avatar asked Dec 05 '19 04:12

Haider Yaqoob


People also ask

How do you fix 535 5.7 8 username and password not accepted?

If getting "Username and Password not accepted" 535 5.7. 8 error, but user name and password work logging onto email via web (with 2-factor authentication), you may need to enable "Access for less secure apps" (allow exceptions to 2-factor authentication) in your email settings.

How do I use NodeMailer app password?

Back to Security in "Signing in to Google" section choose App passwords. From the Select app drop down choose Other (Custom name) and put a name e.g. nodemailer. A modal dialog will appear with the password. Get that password and use it in your code.

Why do I get error 535 every time I login?

Incorrect Username and Password When the username and password entered in the Email client are incorrect, it ends up in Error 535. Again, using the wrong the mail server can also cause authentication failures. Usually, such mismatch in email login and password will be recorded in the mail server logs.

What is the error code for invalid login?

Error: Invalid login: 535-5.7.8 Username and Password not accepted. Learn mor... - DEV Community Error: Invalid login: 535-5.7.8 Username and Password not accepted. Learn more at

What is SMTP error 535 authentication failed?

In short,“ SMTP Error (535): Authentication failed” error happens when there is a problem with SMTP configuration of email clients. Today, we saw how Bobcares solved “SMTP Error 535 Authentication failed”.

Why can't I login to an app with a password?

Google disabled less secure apps, to resolve the issue one need to setup "Login with app password" and to allow the app password "setup two factor authentication" when 2-Step-Verification is on and one get a "password incorrect" error, sign in to your account and go to security, try to use an App Password.


2 Answers

Yes, code is perfect. However, you need to allow less secure apps from your google account to send emails. Through this link. Allow less secure apps From your Google Account

like image 53
Haider Yaqoob Avatar answered Sep 16 '22 12:09

Haider Yaqoob


Go to Less secure app access . convert icon Allow less secure apps to ON.

Link : https://myaccount.google.com/lesssecureapps

like image 43
ijaz khan Avatar answered Sep 20 '22 12:09

ijaz khan



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!