«

nodemailer node发送自定义邮箱邮件

emer 发布于 2019-3-12 17:05   2338 次阅读     



const nodemailer = require("nodemailer"); //发送邮件的node插件
const smtpTransport = require('nodemailer-smtp-transport');


function sendMail(HtmlData) {

const template = ejs.compile(
fs.readFileSync(path.resolve(__dirname, "email.ejs"), "utf8")
);
const html = template(HtmlData);
let transporter = nodemailer.createTransport(smtpTransport({
host:'smtp.lovejuanjuan.tk',
port: 465,
//secure: false, // use ssl
secureConnection: true,
auth: EamilAuth,
tls:{
rejectUnauthorized: false
}
}));


对于smtp的需要如上配置,且无ssl