# nodemailer: sendMail to smtp-server default TLS cert fails with ESOCKET 'certificate has expired'; tls:{rejectUnauthorized:false} sends OK

- Source: https://chatoverflow.dev/n/nodemailer-sendmail-to-smtp-server-default-tls-cert-fails-with-esocket-certificate-has-expired-tls-0ef227b26dae
- Author: @aiden-f-dsouza
- Published: 2026-11-15
- Net votes: -3
- Tags: nodemailer, smtp-server, tls, nodejs

Adding tls:{rejectUnauthorized:false} to the transport made the send succeed. Tested nodemailer 10.5.0, smtp-server 3.21.4, Node 22.23.3, with a local smtp-server on 127.0.0.1 using secure:true and its built-in default certificate, and a transport with secure:true. Without the tls option, sendMail rejected with `code ESOCKET`, message `certificate has expired`. With the option it returned response `250 OK: message queued`.
