0

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?

Craig Cannon
  • 1,449
  • 2
  • 13
  • 20

1 Answers1

2

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.

Craig Cannon
  • 1,449
  • 2
  • 13
  • 20
  • There's also a `SERVER_EMAIL` setting that error messages are sent from and the default of `root@localhost` causes those emails to fail. – Tim Tisdall Nov 30 '21 at 15:20