【发布时间】:2015-04-04 05:51:03
【问题描述】:
如果每封电子邮件都将从您的 process.env.MAIL_URL 环境变量中定义的电子邮件发送,为什么电子邮件包中的 Email.send() 函数包含一个“发件人”参数?
服务器端代码:
process.env.MAIL_URL = 'smtp://my_email%40gmail.com:my_password@smtp.gmail.com:465/'
Meteor.methods({
sendEmail: function (to, from, subject, text) {
check([to, from, subject, text], [String]);
// Let other method calls from the same client start running,
// without waiting for the email sending to complete.
this.unblock();
Email.send({
to: to,
from: from,
subject: subject,
text: text
});
}
});
客户端代码:
Meteor.call('sendEmail',
my_email@email.com,
email,
name,
message);
其中电子邮件、姓名和消息是从表单元素中读取的变量。
【问题讨论】:
标签: javascript email meteor