Question

Working on a Python/Django app, deploying with Heroku and sending emails with Mandrill. I've been able to send emails using my local configuration, but when I deploy to Heroku, the mail doesn't send but Heroku doesn't throw an error. When I check heroku config my Mandrill api key and username are both there.

Here are my email settings from settings.py:

import os
EMAIL_HOST = 'smtp.mandrillapp.com'
EMAIL_PORT = 587
EMAIL_HOST_USER = os.environ.get('MANDRILL_USERNAME')
EMAIL_HOST_PASSWORD = os.environ.get('MANDRILL_APIKEY')
EMAIL_USE_TLS = True

Any idea what might be the problem?

Was it helpful?

Solution

Turns out I needed to add DEFAULT_FROM_EMAIL to my settings.py file. It was working locally because the DEFAULT_FROM_EMAIL was set in global_settings.py, which isn't pushed to Heroku.

Make sure to have a look at your Mandrill API Logs if your messages aren't sending.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top