码迷,mamicode.com
首页 > 其他好文 > 详细

nodemailer + art-template template not found

时间:2020-01-13 11:12:33      阅读:76      评论:0      收藏:0      [点我收藏+]

标签:function   nod   else   code   template   not found   htm   OLE   mes   

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()

nodemailer + art-template template not found

标签:function   nod   else   code   template   not found   htm   OLE   mes   

原文地址:https://www.cnblogs.com/family-626-77/p/12186075.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!