Nodejs 发送邮件

var nodemailer = require("nodemailer");
var mailTitle='http://bemupa.forumieren.com:Best Music Paradise1111';
var fs= require('fs');
sendSSLMail("666")
function sendSSLMail(mailContent){
console.log('mailContent');

var stransporter = nodemailer.createTransport({
service: 'qq',
auth: {
user: '1598828268@qq.com',
pass: '填写qq授权码'
}
});

function ssl(){
var mailOptions = {
from: '"2017 ItaloDance&Handsup Info" <发件人>',
to: '收件人1',
cc:'cc给谁',
subject: mailTitle,
text: mailContent,

attachments:[
{
filename : 'BMPInfo.png',
path: 'BMPInfo.png'
}, {
filename : 'BMPInfo.html',
path: 'BMPInfo.html'
},{
filename : 'DownLoadBMPUrl.txt',
path: 'DownLoadBMPUrl.txt'
}
]
}

return mailOptions;
}

stransporter.sendMail(ssl(), function(error, info){
if(error){
console.log(error);
}else{
console.log('Message sent: ' + info.response);
}
});
}

posted @ 2017-11-06 09:50  公众号python学习开发  阅读(163)  评论(0编辑  收藏  举报