UnhandledPromiseRejectionWarning: Error: Missing credentials for "PLAIN" in nodemailer code example

Example 1: Error: Missing credentials for "PLAIN"

var email_smtp = nodemailer.createTransport({      
  host: "smtp.gmail.com",
  auth: {
    type: "login", // default
    user: "[email protected]",
    pass: "PASSWORD_HERE"
  }
});

Example 2: Error: Missing credentials for "PLAIN"

var email_smtp = nodemailer.createTransport({      
  host: "smtp.gmail.com",
  auth: {
    type: "OAuth2",
    user: "[email protected]",
    clientId: "CLIENT_ID_HERE",
    clientSecret: "CLIENT_SECRET_HERE",
    refreshToken: "REFRESH_TOKEN_HERE"                              
  }
});

Tags:

Misc Example