nodemailer发送激活邮件的问题
发布于 9 年前 作者 toby520 5069 次浏览 最后一次编辑是 8 年前 来自 问答

###问题: Ubuntu12.x服务器下 使用nodemailer模块发送激活邮件,2015年之前,是可以通过该模块发送激活邮件,最近发现无法发送激活邮件到用户 目前使用的smtp 126的邮件发,发送至任何邮箱,都在已发送里面看到发送不成功的提示 如图 p2

各位大神,最近有类似的情况吗? PS:我是以个人126邮箱发送激活邮件的

7 回复

我用qq邮箱没问题

我当时的nodemailer模块是0.3.x版本,14年是可以发的,15年后发不了,现在升级到0.7.x后 QQ是可以发 126照样不能发, 状态都是对方服务器退回

没代码没真相

var nodemailer = require('nodemailer');
console.log("load module");
// create reusable transporter object using SMTP transport
var smtpTransport = nodemailer.createTransport("SMTP", {
    host: "smtp.126.com", // hostname
    secureConnection: true, // use SSL
    port: 465,
    auth: {
        user: "sender@126.com",
        pass: "clienc cookie"
    }
});

// NB! No need to recreate the transporter object. You can use
// the same transporter object for all e-mails

// setup e-mail data with unicode symbols
var mailOptions = {
    from: 'sender@126.com>', // sender address
    to: 'receivers@qq.com', // list of receivers
    subject: 'Hello ✔', // Subject line
    text: 'Hello world ✔', // plaintext body
    html: '<b>Hello world ✔</b>' // html body
};

// send mail with defined transport object
smtpTransport.sendMail(mailOptions, function(error, info) {
    if (error) {
        console.log(error);
    } else {
        console.log('Message sent: ' + info.response);
    }
    // if you don't want to use this transport object anymore, uncomment following line
    //smtpTransport.close(); // shut down the connection pool, no more messages
});

以上代码在nodemailer0.7.x也是运行发送邮件失败

推荐你看一篇文章,http://www.cnblogs.com/Chen-xy/p/4466460.html 关于nodemailer的,当时我想用163邮箱发送邮件,也是折腾了好久,后来发现是配置文件的问题。 需要配置一个services.json文件,文章里面没有,你上github上的例子里面有修改好的。

nodemailer的版本不同,各种配置也不尽相同吧,我使用的版本 有人的也是可以发,而我126以前是可以的 后面就发了 被拒收

我用的0.3.34的没问题,https://github.com/luoyjx/nodemailer-demo 不过没用126的邮箱

回到顶部