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

204
Vistas
Can't send emails with Nodejs

I'm using nodemailer like this:

 const from = "info@my_domain.com";
 const to = 'some_mail@gmail.com';
 const subject = 'my subject';
 const html = '<b>Hello world</b>';

 const smtpOptions = {
   "host": "mail.my_domain.com",
   "port": 587,
   "secure": false,
   "auth": {
     "user": "info@my_domain.com",
     "pass": "12345679"
   },
 }

 const transporter = nodemailer.createTransport(smtpOptions);

 try {
   const a = await transporter.sendMail({
     from,
     to,
     subject,
     html
   });
 } catch (err) {
   console.log(err);
 }   

and I get this error:

Error: self signed certificate at TLSSocket.onConnectSecure (node:_tls_wrap:1532:34) at TLSSocket.emit (node:events:527:28) at TLSSocket._finishInit (node:_tls_wrap:946:8) at TLSWrap.ssl.onhandshakedone (node:_tls_wrap:727:12) { code: 'ESOCKET', command: 'CONN' }

although I have a valid ssl and after some research I came up with adding this line to the smtpOptions :

tls: {
    rejectUnauthorized: false
}

Now I don't get the error but no email is send !

Why I get this error and How to fix this so that I can simply send emails ?

about 4 years ago · Juan Pablo Isaza
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