在下面有mailer.js,但在导入'var email = require('./ models / mailer')'我的'email.send'没有执行?
var config = require('./config');
var email = require('emailjs');
var server = email.server.connect({
host: config.smptRelay
});
module.exports = function send() {
server.send({
text: config.emailText,
from: config.emailFrom,
to: config.emailTo,
subject: config.emailSubject
}, function (err, message) { /*console.log(err || message); */
});
};
答案 0 :(得分:2)
您直接导出该函数,如module.exports
,而不是它的属性。只需将其称为email()
。