0

I am using nodemailer to send emails. Every post ive seen so far sugegest to generate a password in google since 2022. I followed these steps:

  1. from manage your account
  2. select security
  3. from Signing in to Google ==> make your account 2- step verification
  4. from Signing in to Google ==> select app passwords
  5. make a password for nodemailer and use it instead of your password

but still I always get the error:

Invalid login: 535-5.7.8 Username and Password not accepted

my code where I use the generated password:

 let transporter = nodemailer.createTransport({
            host: "smtp.gmail.com",
            port: 465,
            secure: true, 
            auth: {
                user: 'myRegularEmail@gmail.com', 
                pass: 'qwlbhgd...', // generated password
            },
        });
        
        let info = {
            from: 'myRegularEmail@gmail.com', 
            to: "receipient@yahoo.com",
            subject: "Hello ✔", // Subject line
            text: "Hello world?", // plain text body
            html: "<b>Hello worldddd?</b>", // html body
        };
        transporter.sendMail(info, function (err, info) {
            if (err) {
                return ('Error while sending email' + err)
            } else {
               res.status(200).send("it worked")
            }

        });

I feel like Im doing everything how its suggested. What am I doing wrong?

I used a gmail generated password, I use the 2 steps verification and sue the code thats suppose to work.

learncode
  • 127
  • 6
  • Does this answer your question? [Username and Password not accepted when using nodemailer?](https://stackoverflow.com/questions/45478293/username-and-password-not-accepted-when-using-nodemailer) – Refluent Apr 22 '23 at 08:39
  • it does not answer my question. I followed same advice as in that post but im getting that error. – learncode Apr 22 '23 at 09:10
  • Did anyone figure this out? I'm running into the same issue!!!!! – Shazboticus S Shazbot Apr 29 '23 at 01:24

0 Answers0