Error: self signed certificate in certificate chain Nodejs nodemailer express

后端 未结 1 611
北恋
北恋 2021-01-01 01:29

So I\'m doing this app in Node.js with express and I have this error Error: self signed certificate in certificate chain

at Error (native)
    at TLSSocket.&         


        
相关标签:
1条回答
  • 2021-01-01 02:28

    There is a good discussion about using Nodemailer with self-signed certificates in this GitHub issue. Specifically, this post can help get rid of the error message:

    If you know that the host does not have a valid certificate you can allow it in the transport settings with tls.rejectUnauthorized option:

    var transporter = nodemailer.createTransport(smtpTransport({ host: "outmail.abc.co.th", // hostname secure: false, // use SSL port: 25, // port for secure SMTP auth: { user: "username@abc.co.th", pass: "passwordmail" }, tls: { rejectUnauthorized: false } }));

    However, if you believe the mail services you are trying to use have valid certificates, you might have a local issue with your machine or network.

    0 讨论(0)
提交回复
热议问题