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

288
Vistas
Nodemailer throws "No recipients defined" error but email is actually sent

I am experiencing an unexpected behaviour from nodemailer:

here is my code:

  let transporter = nodemailer.createTransport({
   host: 'outlook.office365.com',



auth: {
  user: process.env.MAIL_USER, // generated ethereal user
  pass: process.env.MAIL_PASS, // generated ethereal password
},
   tls: {
    rejectUnauthorized: false
}});



 let info =  transporter.sendMail({

 from: '"Mark 👻"mymail@outlook.com', 
 to: "anothermailOfMine@gmail.com", 
 subject: "Hello ✔", 
 text: "Hello world?", 
 html: `<b>
 <a href='http://localhost:3000/activate_user/${result._id}'>
 <button>Activate 
 profile</button></a> 
 </b>`, // html body
 });

transporter.sendMail(info, function (err, info) {
if (err) {
console.log(err);
res.json(err);
} else {
  console.log(' mail sent');
res.json({success:true, message:''});
}})};

The sendMail method returns an error even if the mail is actually sent successfully, which means that the front-end never receives a positive response about the sending, that's the error i just mentioned:

Error: No recipients defined
at SMTPConnection._formatError 

I wonder if I am doing something wrong.

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

0

I did find out what the problem was eventually: the send mail method needed to be called in an asynchronous function.

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