let transporter = nodemailer.createTransport({
host: 'smtp.googlemail.com',
port: 465,
secure: true,
auth: {
user: '*******@gmail.com', //Gmail username
pass: '******' // Gmail password
},
tls:{
rejectUnauthorized: false
}
});
let mailOptions = {
from: ' "Nodemailer Contact" <********@gmail.com> ',
to: '********@gmail.com',
subject: 'Node Contact Request',
text: '.......',
html: output
};
transporter.sendMail(mailOptions, (err, info)=>{
if(err) {
return console.log(err);
}
console.log("Message Sent: %s", info.messageId);
console.log("Preview URL: %s", nodemailer.getTestMessageUrl(info));
res.render('contact', {msg: 'Email has been Sent!'}, {layout: false});
//res.render('contact', {layout: false});
});
错误:
TypeError:回调不是函数 在即时._onImmediate(/home/sDesktop/EmailPage/node_modules/express-handlebars/lib/utils.js:18:13) 在runCallback(timers.js:794:20) 在tryOnImmediate(timers.js:752:5) 在processImmediate [as _immediateCallback](timers.js:729:5)