search

Home  >  Q&A  >  body text

javascript - nodemailer连接超时,怎么解决?

使用的是Gmail

const smtpTransport = nodemailer.createTransport({
        service: "gmail",
        auth: {
            user: "xxxxxx@gmail.com",
            pass: "xxxxx"
        }
    })
    const mailOptions={
        from: "xxxxxx@gmail.com",
        to : 'xxxx@qq.com',
        subject : req.query.subject,
        text : req.query.content
    }
    smtpTransport.sendMail(mailOptions, function(error, response){
        if(error){
            console.log(error);
            res.status(504).end("error");
        }else{
            console.log("Message sent: " + response.message);
            res.status(200).end("sent");
        }
    })

有时候可以成功发送邮件,有时候发送超时,qq邮箱也设置了白名单,是不是qq邮箱有限制次数?怎么解决

巴扎黑巴扎黑2873 days ago539

reply all(1)I'll reply

  • 高洛峰

    高洛峰2017-04-17 16:32:46

    It should be a problem with the gmail email service. You can try 163 or Sina's email address, it should be fine.

    reply
    0
  • Cancelreply