用nodejs做一下发送邮件例子

var nodemailer = require("nodemailer");
 
var transport = nodemailer.createTransport("SMTP", {
    host: "smtp.qq.com",
    secureConnection: true, // use SSL
    port: 465, // port for secure SMTP
    auth: {
        user: "yjk99@99.com",
        pass: "xxxxxxx"
    }
});
 
transport.sendMail({
    from : "11111111@qq.com",
    to : "22222222@qq.com",
    subject: "邮件主题",
    generateTextFromHTML : true,
    html : "<p>这是封测试邮件</p>"
}, function(error, response){
    if(error){
        console.log(error);
    }else{
        console.log("Message sent: " + response.message);
    }
    transport.close();
});



转自:https://blog.gaoqixhb.com/p/53fc1e3991d7c21b313ff981
posted @ 2016-06-06 10:48  公众号python学习开发  阅读(344)  评论(0编辑  收藏  举报