简体   繁体   中英

Meteor email.send() from field purpose

Why does the Email.send() function from the email package contain a 'from' argument if every email will be sent from the email defined in your process.env.MAIL_URL environmental variable?

Server-side code:

 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 }); } }); 

Client-side Code:

 Meteor.call('sendEmail', my_email@email.com, email, name, message); 

where email, name, and message are variables that are read from form elements.

In your case, when sending through a Gmail account, you are correct. The from email address must match the email address associated with the login information. However, when sending through an SMTP relay service, like Amazons SES or MailChimp, it is possible to set the from address to any verified email address or domain, so you can send from multiple email addresses.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM