Last active
February 12, 2021 17:05
-
-
Save LeCoupa/9879221 to your computer and use it in GitHub Desktop.
Configure SMTP with Meteor --> https://github.com/LeCoupa/awesome-cheatsheets
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# add the email package | |
meteor add email |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 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; | |
}); |
Yes that was a typo. Thank you!
@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
@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
Should the lines inside the
smtp
object not be terminated with a comma,
instead of a semicolon;
?