2 xxxxssss12 xxxxssss12 于 2016.04.29 13:44 提问

nodeJs的nodemailer发邮件报错

源码如下:
emailUtil.sendOneEmail = function(email, content) {
if (!email || !content) {
return ;
}
var transporter = nodemailer.createTransport({
host: 'smtp.sina.com',
secureConnection: true,
port: 465,
auth: {
user: 'xxx@sina.com',
pass: 'xxx'
}
});
var mailOptions = {
from: 'xxx xxx@sina.com', // sender address
to: email, // list of receivers
subject: 'xxx confirm code', // Subject line
html: content // html body
};
transporter.sendMail(mailOptions, function(error, info){
if(error){
console.log(error);
}else{
console.log('Message send: ' + info.response);
}
});
};

发邮件报错:
{ [Error: Hostname/IP doesn't match certificate's altnames: "Host: smtp.sina.com.cn. is not in the cert's altnames: DNS:*.sina.cn, DNS:sina.cn"]
reason: 'Host: smtp.sina.com.cn. is not in the cert\'s altnames: DNS:*.sina.cn, DNS:sina.cn',
host: 'smtp.sina.com.cn.',
cert:
{ subject:
{ C: 'CN',
ST: 'Beijing',
L: 'Beijing',
O: 'Sina.com Technology(China)Co.,ltd',
OU: 'Sina.com Technology(China)Co.,ltd',
CN: '*.sina.cn' },
issuer: { C: 'US', O: 'GeoTrust Inc.', CN: 'GeoTrust SSL CA - G3' },
subjectaltname: 'DNS:*.sina.cn, DNS:sina.cn',
infoAccess: { 'OCSP - URI': [Object], 'CA Issuers - URI': [Object] },
modulus: 'C948A2A9200320BF1EF6DDA295182CF133C19254B57C769897E831E38E4762931F22B507131159AA7EC55862465EEABE37D1EF315AB97489EEE1BA8E569CD9E96553A6C820093B0ECBA071AF06266356B04DD776E95E44B062FA92141B4A45E2CE905B11967DFBF2672233CB163919934ADEB18D3A129565CC63473ED7DEFE530D140B2037E20293F50BC7EFE2A7DB79FC38577A7A12A10FD7C50AEF14B5B4C857FCA2D310435FD9077093B8AF3E3524B90331DF4B9119795EFEA9B25CAD0E0F767EA9A9A38BEEA9DE6C6B6F1862F4F28C3E16202688E5F619F2DC62EBF89DF7C762AAE32ABA94B003A90A0FBA28F4C896C46E386E5DC0CC6F151F3D23004279',
exponent: '0x10001',
valid_from: 'Sep 29 00:00:00 2015 GMT',
valid_to: 'Dec 28 23:59:59 2017 GMT',
fingerprint: 'A1:8D:2F:D1:DD:EF:5B:C4:A2:D4:0B:30:FF:2C:1A:5E:29:34:D1:E3',
ext_key_usage: [ '1.3.6.1.5.5.7.3.1', '1.3.6.1.5.5.7.3.2' ],
serialNumber: '69939B35FEA6870306B207D72D7A7963',
raw: } }

看起来是证书的问题?莫名其妙,不知道原因。

3个回答

CSDNXIAON
CSDNXIAON   2016.04.29 13:52

学会看nodeJS报错
----------------------同志你好,我是CSDN问答机器人小N,奉组织之命为你提供参考答案,编程尚未成功,同志仍需努力!

qq_24532335
qq_24532335   2016.05.31 08:52

我也遇到了相同的问题请问你解决了吗

xxxxssss12
xxxxssss12 我换成163邮箱就能发了
4 个月之前 回复
yimengyuanyun
yimengyuanyun   2017.05.02 15:45

你好,请问你后来解决了吗,是什么原因,怎么解决?

xxxxssss12
xxxxssss12 我换成163邮箱就能发了
4 个月之前 回复
Csdn user default icon
上传中...
上传图片
插入图片
准确详细的回答,更有利于被提问者采纳,从而获得C币。复制、灌水、广告等回答会被删除,是时候展现真正的技术了!