nodejs使用nodemailer实现smtp发送邮件代码

代码语言:nodejs

所属分类:通讯

代码描述:nodejs使用nodemailer实现smtp发送邮件代码

代码标签: nodejs nodemailer smtp 邮件 发送

下面为部分代码预览,完整代码请点击下载或在bfwstudio webide中打开

// load nodemailer as follows
// npm install nodemailer --save
var nodemailer = require('nodemailer');
// create reusable transporter object using SMTP transport
var transporter = nodemailer.createTransport({
    "host": "smtpdm.aliyun.com",
    "port": 25,
    //"secureConnection": true, // use SSL, the port is 465
    "auth": {
        "user": 'username@userdomain', // user name
        "pass": 'xxxxxxx'         // password
    }
});
// 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: 'NickName<username@userdomain>', // sender address mailfrom must be same with the user
    to: 'x@x.com, xx@xx.com', // list of receivers
    cc:'haha<xxx@xxx.com>', // copy for receivers
    bcc:'haha<xxxx@x.........完整代码请登录后点击上方下载按钮下载查看

网友评论0