For the emails being send to, amongst others, confirm users email addresses on registration, we are using Mandrill, the transactional email tool provided by the creators of MailChimp.
First step is to browse to mandrill.com and register for an account. Then active and login to this account and ensure you have an domain added, verified and configured.
Now update config.py in the application root of this app to verify the MAIL_SERVER, MAIL_PORT, and MAIL_DEFAULT_SENDER entries. You can find this information on the 'SMTP & API login' under 'Settings' in Mandrill.
At the same 'SMTP & API login' you can find your API Keys. It's smart to create a new key by clicking '+ New API Key', create this new key and copy the key.
To ensure our private credentials are not ending up in the git repo (or worse), we are storing all private keys in variables on our environment. Same for the Mandrill login credentials:
- In your terminal enter
nano $VIRTUAL_ENV/bin/postactivate
- Add
export MAIL_USERNAME="Your Mandrill Username"
- Add
export MAIL_PASSWORD="Your Mandrill API Key"
If you want to use Mandrill as well on your Heroku staging or production environment, you also need to add the login details there:
For staging:
- Run
heroku config:set MAIL_USERNAME="Your Mandrill Username" --remote staging
- Run
heroku config:set MAIL_PASSWORD="Your Mandrill API Key" --remote staging
And for production:
- Run
heroku config:set MAIL_USERNAME="Your Mandrill Username" --remote production
- Run
heroku config:set MAIL_PASSWORD="Your Mandrill API Key" --remote production