【问题标题】:Meteor email.send() from field purpose来自现场目的的流星 email.send()
【发布时间】: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


    【解决方案1】:

    在您的情况下,当通过 Gmail 帐户发送时,您是正确的。 from 电子邮件地址必须与与登录信息关联的电子邮件地址匹配。但是,当通过 SMTP 中继服务(如 Amazons SES 或 MailChimp)发送时,可以将 from 地址设置为任何经过验证的电子邮件地址或域,因此您可以从多个电子邮件地址发送。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2015-12-21
      • 2015-11-23
      • 1970-01-01
      • 2016-05-16
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多