23

enter image description here

Sending an email using NodeMailer & Gmail

Google has reported that after May 30 third party apps cannot use username and password for signing in. Does this affect nodemailer. We usually allow less secure APP in the gsuit gmail setting before using it in nodemailer.

    var transporter = nodemailer.createTransport({
        service: 'gmail',
        auth: {
         user: 'youremail@address.com',
         pass: 'yourpassword'
        }
     });
Ujjual
  • 958
  • 2
  • 10
  • 36
  • 1
    I wonder if this would work with an [apps password](https://support.google.com/accounts/answer/185833?hl=en) instead. its that or there going to have to implement xoauth2. Have you considered asking on their [issue forum](https://github.com/nodemailer/nodemailer/issues) – Linda Lawton - DaImTo Mar 15 '22 at 06:46
  • I will try with app password,if that goes south I ll ask in the forum. – Ujjual Mar 16 '22 at 05:32
  • Do you find any solution ? The app password seem to require 2-step verification to be enabled... – user2178964 May 31 '22 at 15:50

3 Answers3

40

It would help if you generated an app password to use nodemailer.

  1. First, you need to turn on two-factor-authentication.
  2. And then in your manage account go to security.
  3. You can see the app password below two-step verification.
  4. Go to app password select app other and write custom app name (example project name) and click on generate.
  5. You get a password use that password instead of your mail password.
HILARUDEEN S ALLAUDEEN
  • 1,722
  • 1
  • 18
  • 33
Vipul Ram
  • 646
  • 5
  • 9
1

I've been digging all over for this. Their docs are pretty woeful about the change. Found this, not definitive...I'm in the "set up app password let's see if it still works" camp.

Note the reply "Second, yes, the best information we have is that App Passwords will continue to work."

https://support.google.com/mail/thread/157808790/will-imap-work-after-may-30th?hl=en

Tim C
  • 11
  • 1
1

I had the same issue and solved it.

Follow these steps:

1)Go to the google account security section 2) turn on 2-step verification under "singing in" to google (else 3rd step is not possible) 3) under signing in to google you will find App passwords, click it 4) select the "select app" and click custom app 5) Type any name of your choice and generate a password. Now use the same email account and instead of your real password use the generated password.

Zarak Khan
  • 21
  • 4