简体   繁体   English

nodemailer错误:证书链中的自签名证书

[英]nodemailer error: self signed certificate in certificate chain

I googled this but could not find an answer for my problem. 我用Google搜索,但无法找到问题的答案。 here is my code 这是我的代码

var xoauth2 = require('xoauth2');

var transporter = nodemailer.createTransport({
  service: "Gmail",
  auth: {
    xoauth2: xoauth2.createXOAuth2Generator({
      user: "dude@gmail.com", 
      clientId: "-",
      clientSecret: "-",
      refreshToken: "-"
       })
  }
});

app.post('/send', function (req, res) {
  var mailOptions = {
      from: 'dude',
      to: 'derp@gmail.com',
      subject: 'Email Example',
      text: 'username: ' + req.body.firstname,
      attachments:[
        {
          filename: req.files.myfile.name,
          content: new Buffer(req.files.myfile.data,'utf-8')
        }
      ]
  };

  transporter.sendMail(mailOptions, function(error, info){
    if(error){
      console.log(error);
      res.send(error);
    } else {
      console.log('Message sent!!');
      res.send('sent');
    }
  });
});

i used to have this problem back when i did not use oauth2, now that im using it i thought it would go away but it didnt. 我曾经有过这个问题,当我没有使用oauth2时,现在我正在使用它,我认为它会消失,但它没有。 what am I doing wrong here? 我在这做错了什么?

Ok so it was because of the Anti-Virus software. 好的,因为它是由于反病毒软件。 i swear things like this make me feel like quitting. 我发誓这样的事让我觉得好像要放弃。

Same was with me. 跟我一样。 My antivirus is AVG . 我的防病毒软件是AVG Instead of turning the antivirus off in AVG you can go to Settings>Components>Email Shield>Customize>SSL Scanning and uncheck "Scan SSL connections". 您可以转到设置>组件>电子邮件屏蔽>自定义> SSL扫描,然后取消选中 “扫描SSL连接”,而不是在AVG中关闭防病毒软件。

In Avast Go Settings/Protection/Core Shields/Configure shield settings/Mail Shield and uncheck "Scan outbound emails (SMTP)" Avast Go设置/保护/核心防护/配置防护设置/ Mail Shield中, 取消选中 “扫描出站电子邮件(SMTP)”

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM