[英]self signed certificate in certificate chain error in mail
I tried to write a simple mail program.我试图编写一个简单的邮件程序。 I used node mailer and SMTP protocol module.
我使用了节点邮件程序和SMTP 协议模块。 I executed.
我执行了。 But it shows an error like:
但它显示如下错误:
self signed certificate in certificate chain error in mail
邮件中证书链错误中的自签名证书
what is the problem?问题是什么?
var express = require('express'); var app=express(); var nodemailer = require('nodemailer'); var smtpTransport = require('nodemailer-smtp-transport'); app.get('/nodemail', function(req, res, next) { var transporter = nodemailer.createTransport(smtpTransport({ service: 'Gmail', host: 'smtp.gmail.com', port: 465, auth: { user: 'demodevelopers6@gmail.com', pass: '***********' } })); var link="https://codeforgeek.com/2016/06/node-js-redis-tutorial-building-email-verification-system/"; transporter.sendMail({ from: "demodevelopers6@gmail.com", subject:"sailjstutorials" , to: "vignesh.mack03@gmail.com", html : "Hello"+"vignesh <br> Please Click on the link to verify your email.<br><a href="+link+">Click here to verify</a>" }, function(error, info) { if (error) { return console.log(error); } console.log('Message %s sent: %s', info.messageId, info.response); console.log("Mail sent successfully"); res.write("Mail sent successfully"); }); }); app.listen(8086,function() { console.log("port listening"); });
I had the same issue just now, try checking out the link below for a more detailed response.我刚才遇到了同样的问题,请尝试查看下面的链接以获得更详细的回复。
Error: self signed certificate in certificate chain Nodejs nodemailer express 错误:证书链中的自签名证书 Nodejs nodemailer express
Use tls.rejectUnauthorized = false to help avoid the issue.使用 tls.rejectUnauthorized = false 来帮助避免该问题。
Example:例子:
let transporter = nodemailer.createTransport({
service: 'gmail',
auth: {
user: 'myemail@gmail.com',
pass: 'password'
},
tls: {
rejectUnauthorized: false
}
});
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.