Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

994
Views
No se encontraron destinatarios en nodemailer

Estoy tratando de enviar un correo usando nodemailer. Creo que he dado todas las opciones de correo correctamente. Como lo he confirmado al imprimir mailOptions en la consola.

Y también he comprobado la autenticación y el usuario. Son correctos y bien importados.

Pero aún no recibo ningún error definido por el destinatario. ¿Dónde está el problema?

ingrese la descripción de la imagen aquí

Aquí está toda la función de enviar correo electrónico

 function sendEmail(payload) { var fromEmail = config.cfg.smtp.fromEmail; console.log(fromEmail); var toEmail = payload.to; var subject = payload.subject; var content = `<p>Greetings! your order is on the way. Order details are</p>`; let smtpTransport = nodemailer.createTransport({ service: "gmail", auth: { user: config.cfg.smtp.auth.user, pass: config.cfg.smtp.auth.pass, }, }); // setup email data with unicode symbols let mailOptions = { from: fromEmail, // sender address. Must be the same as authenticated user if using Gmail. to: toEmail, // receiver subject: subject, // subject html: content, // html body }; return new Promise(function (resolve, reject) { smtpTransport.sendMail({ mailOptions }, function (err, data) { console.log(mailOptions) if (err) { console.log("your mail could not be sent"); return reject(err); } resolve(data); console.log("Your mail is sent"); }); });

}

over 4 years ago · Santiago Trujillo
1 answers
Answer question

0

Está enviando sus mailOptions dentro de otro objeto. Intente lo siguiente en su lugar.

 return new Promise(function (resolve, reject) { smtpTransport.sendMail(mailOptions, function (err, data) { // mailOptions is already an object. console.log(mailOptions) if (err) { console.log("your mail could not be sent"); return reject(err); } resolve(data); console.log("Your mail is sent"); });
over 4 years ago · Santiago Trujillo Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!