我想汤姆使用nodemailer我的应用程序发送电子邮件,我的代码看起来是这样的:错误:主机名/ IP不匹配证书的altnames Node.js的
var smtpTransport = nodemailer.createTransport(smtpTransport({
pool: true,
host: 'smtp.myemailserver.com',
port: 587,
auth: {
user: '[email protected]',
pass: '******'
}
}));
var mailOptions = {
from: '[email protected]',
to: '[email protected]',
subject: 'test ',
text: 'Hello world ',
html: 'Hello world '
};
smtpTransport.sendMail(mailOptions, function(error, info){
if(error){
console.log(error);
}else{
console.log('Message sent: ' + info.response);
}
});
,但我得到的错误,我不能弄清楚:
[Error: Hostname/IP doesn't match certificate's altnames: "Host: smtp.myemailserver.com. is not in the cert's altnames: DNS:secure.emailsrvr.com, DNS:www.secure.myemailserver.com"]
reason: 'Host: smtp.myemailserverr.com. is not in the cert\'s altnames: DNS:secure.myemailserver.com, DNS:www.myemailserver.com',
host: 'smtp.myemailserver.com.',
cert:
{ subject: { OU: [Object], CN: 'secure.myemailserver.com' },
issuer:
{ C: 'GB',
ST: 'Greater Manchester',
L: 'Salford',
O: 'COMODO CA Limited',
CN: 'COMODO RSA Domain Validation Secure Server CA' },
subjectaltname: 'DNS:secure.emailsrvr.com, DNS:www.secure.myemailserver.com',
infoAccess: { 'CA Issuers - URI': [Object], 'OCSP - URI': [Object] }
我尝试添加
tls {
rejectUnauthorized: false
}
电子邮件选项,但会要求挡住了我的电子邮件,所以请任何帮助
2017-04-18
sarya
+0
这是什么意思“阻止我的电子邮件”?请提供带有tls选项的日志。 –
+0
[发送电子邮件与nodemailer](https://stackoverflow.com/questions/29099582/sending-emails-with-nodemailer) –