var nodemailer = require("nodemailer")
var template = require("art-template")
var fs = require("fs")
var data = require("./data")
const transporter = nodemailer.createTransport({
host: 'smtp.163.com',
port: 465,
auth: {
user: '******@163.com',
pass: '******'
}
});
var sendmail = function () {
var html = template(__dirname + '/template/index.html', data)
var option = {
from: "*****@163.com",
to: "******@163.com",
subject: "test",
html: html
}
transporter.sendMail(option, function (error, response) {
if (error) {
console.log("fail:" + error);
} else {
console.log("success:" + response.messageId);
}
})
}
sendmail()