Setting MAIL_URL when executing `meteor deploy`


#1

I’m trying to send emails via Sendgrid from an application deployed via meteor deploy, per the instructions here.

Those instructions involve putting my Sendgrid password in a JS file in my codebase, but I’d also like to make my code public on github and not reveal my Sendgrid password.

Locally, I can easily MAIL_URL=… meteor, but I’m having trouble figuring out the best way to get my MAIL_URL set when meteor deploying.

I don’t see any documentation about setting environment variables when running meteor deploy.

The “Meteor settings” interface seems useful, and I thought I could read from it at Meteor.startup time and set process.env.MAIL_URL that way. but from some local tests, Meteor.settings has not been initialized in functions called on the server at Meteor.startup time. Should I be able to access Meteor.settings in a Meteor.startup function?

Any other ideas on how to get MAIL_URL set through meteor deploy?


#2

For apps deployed with meteor deploy, MAIL_URL defaults to an account (provided by Mailgun) which allows apps to send up to 200 emails per day; you may override this default by assigning to process.env.MAIL_URL before your first call to Email.send.
http://docs.meteor.com/#/full/email

You could use https://github.com/ogourment/settings