nodemailer node发送自定义邮箱邮件

Others 2019-03-12 09:05:54 2019-03-12 09:05:54 2351 次浏览


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