【问题标题】:Error: self signed certificate in certificate chain Nodejs nodemailer express错误:证书链中的自签名证书 Nodejs nodemailer express
【发布时间】:2018-03-26 07:50:58
【问题描述】:

所以我在 Node.js 中用 express 做这个应用程序,我有这个错误 错误:证书链中的自签名证书

at Error (native)
    at TLSSocket.<anonymous> (_tls_wrap.js:1092:38)
    at emitNone (events.js:86:13)
    at TLSSocket.emit (events.js:185:7)
    at TLSSocket._finishInit (_tls_wrap.js:610:8)
    at TLSWrap.ssl.onhandshakedone (_tls_wrap.js:440:38) code: 'ESOCKET', command: 'CONN' }
POST /contact/send - - ms - -

我已经更换了邮件服务,并且我的杀毒软件也被禁用了,我在网上找不到解决方案,有点帮助对大家都有好处

谢谢你

【问题讨论】:

    标签: node.js nodemailer


    【解决方案1】:

    this GitHub issue 中有一个很好的讨论关于使用带有自签名证书的 Nodemailer。具体来说,this post 可以帮助摆脱错误信息:

    如果您知道主机没有有效证书,您可以在传输设置中使用tls.rejectUnauthorized 选项允许它:

    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 } }));

    但是,如果您认为您尝试使用的邮件服务具有有效证书,则您的机器或网络可能存在本地问题。

    【讨论】:

    • OP,你应该接受这个作为答案,这显然有效
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2017-12-18
    • 2020-08-24
    • 1970-01-01
    • 2012-08-24
    • 2015-09-08
    • 2022-06-16
    • 1970-01-01
    相关资源
    最近更新 更多