Search code examples
gmailnodemailer

How to use Nodemailer with Google?


Hello I made a NodeJs backend and I implemented nodemailer. The only issue is I get the error with Invalid Login, because I don't have less secure apps turned on. I know, but I went to google and I clicked on the less secure app section and this is what I get

This setting is no longer available. Learn more

Does anyone solved the error different way and is able to send emails?


Solution

  • When you want to send email over Gmail SMTP, google enable you to set up App password. You have to have set up 2-Step verification in your google account. Once 16 digit password are generated, you just replace password for login (username is your email address, that does not change).

    Sources:

    Google: Sign in with App Passwords