我的gmail帐户也获得了更少的安全应用状态
const transporter = nodemailer.createTransport({
service: 'gmail',
auth: {
user: worker_email,
pass: worker_pass
}
})
当我尝试时
transporter.sendEmail(options)
我得到一个错误:
Error: self signed certificate in certificate chain
at TLSSocket.onConnectSecure (_tls_wrap.js:1321:34)
at TLSSocket.emit (events.js:223:5)
at TLSSocket._finishInit (_tls_wrap.js:794:8)
at TLSWrap.ssl.onhandshakedone (_tls_wrap.js:608:12) {
code: 'ESOCKET',
command: 'CONN'
}
请看下面的简短回答:https://stackoverflow.com/a/64913747/5172977
基本上,这可能与您的交通设置有关。
以下是使用Etheal.email 的开发环境示例
const transporter = nodemailer.createTransport({
host: 'smtp.ethereal.email',
port: 587,
auth: {
user: 'some-user-name@ethereal.email',
pass: 'password'
},
// === add this === //
tls : { rejectUnauthorized: false }
});