Skip to content

Instantly share code, notes, and snippets.

@LeCoupa
Last active February 12, 2021 17:05
Show Gist options
  • Save LeCoupa/9879221 to your computer and use it in GitHub Desktop.
Save LeCoupa/9879221 to your computer and use it in GitHub Desktop.
# add the email package
meteor add email
// server/smtp.js
Meteor.startup(function () {
smtp = {
username: 'your_username', // eg: [email protected]
password: 'your_password', // eg: 3eeP1gtizk5eziohfervU
server: 'smtp.gmail.com', // eg: mail.gandi.net
port: 25
}
process.env.MAIL_URL = 'smtp://' + encodeURIComponent(smtp.username) + ':' + encodeURIComponent(smtp.password) + '@' + encodeURIComponent(smtp.server) + ':' + smtp.port;
});
@yauh
Copy link

yauh commented Oct 16, 2014

Should the lines inside the smtp object not be terminated with a comma , instead of a semicolon ;?

@LeCoupa
Copy link
Author

LeCoupa commented Oct 23, 2014

Yes that was a typo. Thank you!

@sahanDissanayake
Copy link

@LeCoupa, so with this I can send unlimited emails ? reliably ?

Is there a way to use my own server, rather than using google or sendgrid or anyother service ?

Thanks

@louwers
Copy link

louwers commented Jul 28, 2016

@sahanDissanayake You can set up your own mail server, but it's quite hard (unless you use something like Mail-in-a-box) and it is generally discouraged, because your messages are much more likely to be marked as spam.

That said if you can rely on the SMTP server you can rely on this code to work too.

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