2015-04-03 51 views
0

为什么从电子邮件包Email.send()函数包含“从”的说法,如果每封邮件将被从你的process.env.MAIL_URL环境变量定义的电子邮件发送?流星email.send()从外地目的

服务器端代码:

process.env.MAIL_URL = 'smtp://my_email%40gmail.com:[email protected]: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', 
 
    [email protected], 
 
    email, 
 
    name, 
 
    message);

,其中电子邮件,姓名和消息是variabl es从表单元素中读取。

回答

1

在你的情况,通过Gmail帐户发送的时候,你是正确的。 from电子邮件地址必须与登录信息相关的电子邮件地址匹配。然而,通过SMTP中继服务发送的时候,像亚马逊SES或MailChimp,可以到from地址设置为任何验证的电子邮件地址或域名,这样你就可以从多个电子邮件地址发送邮件。