我正在尝试使用callback
函数,它给了我错误: -
TypeError: undefined is not a function at MailComposer.returnCallback
这样定义的函数: -
exports.sendMailMsg = function (templateName, locals, placeHolders, callback) {
......
smtpTransport.sendMail(mailOptions, function (err, data) {
if(err){
console.log('Error occured');
console.log(err.message);
callback(err);
}
console.log('Message sent successfully!');
});
}
以上函数调用如下: -
mail.sendMailMsg('ForgetPassword', locals, function (err){
if(err){
console.log('from call:'+ err);
res.render('error', {
status: 500
});
}
});
关于最新情况的任何想法?