我正在使用meteor电子邮件包从我的meteor应用程序发送电子邮件,如官方文档中所述 - http://docs.meteor.com/#/full/email_send 但问题是,无论何时收到电子邮件,来自电子邮件地址始终与电子邮件地址相同。我对这两个地址进行了硬编码,结果相同。代码与文档中提供的相同:
sendEmail: function (from, name, subject, text, to) {
console.log("from == " + from);
console.log("to == " + to);
check([from, name, subject, text, to], [String]);
this.unblock();
Email.send({
to: to,
from: from,
subject: subject,
text: text
});
}
Meteor.startup(function () {
smtp = {
username: '<my email id>',
password: 'xxxxxxxx', // masked - a gmail application-specific 16 character password to use for two-factor auth
server: 'smtp.gmail.com',
port: 587 // also tried 465 to no avail
};
process.env.MAIL_URL = 'smtp://' + encodeURIComponent(smtp.username) + ':' +
encodeURIComponent(smtp.password) + '@' + encodeURIComponent(smtp.server) + ':' + smtp.port;
});
我该如何解决这个问题?