Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

235
Vistas
making nodemailer send emails with different gmail accounts

i authenticate with passportjs with success but nodemailer only send emails with one email which is the one used in the console.cloud.google.

wheni try other gmail accounts, i get this error:

Error: Invalid login: 535-5.7.8 Username and Password not accepted. Learn more at 535 5.7.8 https://support.google.com/mail/?p=BadCredentials u6sm13346885wrp.0 - gsmtp at SMTPConnection._formatError (/var/www/html/Recrute/node_modules/nodemailer/lib/smtp-connection/index.js:784:19) at SMTPConnection._actionAUTHComplete (/var/www/html/Recrute/node_modules/nodemailer/lib/smtp-connection/index.js:1536:34) at SMTPConnection. (/var/www/html/Recrute/node_modules/nodemailer/lib/smtp-connection/index.js:1515:26) at SMTPConnection._processResponse (/var/www/html/Recrute/node_modules/nodemailer/lib/smtp-connection/index.js:947:20) at SMTPConnection._onData (/var/www/html/Recrute/node_modules/nodemailer/lib/smtp-connection/index.js:749:14) at TLSSocket.SMTPConnection._onSocketData (/var/www/html/Recrute/node_modules/nodemailer/lib/smtp-connection/index.js:189:44) at TLSSocket.emit (events.js:376:20) at addChunk (internal/streams/readable.js:309:12) at readableAddChunk (internal/streams/readable.js:284:9) at TLSSocket.Readable.push (internal/streams/readable.js:223:10) { code: 'EAUTH', response: '535-5.7.8 Username and Password not accepted. Learn more at\n' + '535 5.7.8 https://support.google.com/mail/?p=BadCredentials u6sm13346885wrp.0 - gsmtp', responseCode: 535, command: 'AUTH XOAUTH2' }

i added all the emails to test users.

the code

      type: 'oauth2',
      user: req.user.email,
      clientId: clientId,
      clientSecret: clientSecret,
      refreshToken: refreshToken,
  };
  
  var mailOptions = {
      from: req.user.email,
      to: 'email@gmail.com',
      subject: req.query.sbjct,
      text: req.query.msg,
      html: req.query.msg,
  };
  
  var transporter = nodemailer.createTransport({
      service: 'gmail',
      auth: auth,
  });
  
  transporter.sendMail(mailOptions, (err, res) => {
      if (err) {
          return console.log(err);
      } else {
          res.send('done !');
      } ```

about 4 years ago · Juan Pablo Isaza
1 Respuestas
Responde la pregunta

0

Gmail does not fully allow sending mails from third party apps. So for you to send mails from a third party app (like your app using nodemailer) you need to go to that gmail account settings and lower gmail security for that account [less secure][1]. nodemailer docs

and your createTransport should look like this

    let transporter = nodemailer.createTransport({
    host: "smtp.gmail.email",
    port: 587,
    secure: false, // true for 465, false for other ports
    auth: {
      user: your username, // generated gmail user
      pass: your password, // generated gmail password
    },
  });
about 4 years ago · Juan Pablo Isaza Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda