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

203
Views
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
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!