Skip to content

Instantly share code, notes, and snippets.

@aaronthorp
Last active November 9, 2017 03:23
Show Gist options
  • Star 5 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save aaronthorp/8410571 to your computer and use it in GitHub Desktop.
Save aaronthorp/8410571 to your computer and use it in GitHub Desktop.
SMTP via SendGrid using Email package with Meteor
if (Meteor.isServer) {
Meteor.startup(function () {
process.env.MAIL_URL = 'smtp://username:password@smtp.sendgrid.net';
Accounts.emailTemplates.siteName = "My Website Name";
Accounts.emailTemplates.from = "My Website Name <noreply@mywebsite.com>";
Accounts.emailTemplates.resetPassword.subject = function(user) {
return "How to reset your password for My Website Name";
};
Email.send({
from: "My Website Name <noreply@mywebsite.com>",
to: "youremail@address.com",
subject: "noreply@mywebsite.com | You have received a reply to your enquiry",
html: "Here is <b>some</b> text!"
});
});
}
@hamxiaoz
Copy link

hamxiaoz commented Mar 7, 2016

NOTE the username/password could be different than your account, I create separate user (with Mail checked), you can do it here: https://app.sendgrid.com/settings/credentials

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment