Django not sending emails to admins


Question

According to the documentation, if DEBUG is set to False and something is provided under the ADMINS setting, Django will send an email whenever the code raises a 500 status code. I have the email settings filled out properly (as I can use send_mail fine) but whenever I intentionally put up erroneous code I get my 500.html template but no error email is sent. What could cause Django to not do this?

1
62
9/12/2009 2:57:59 AM

In my case the cause was missing SERVER_EMAIL setting.

The default for SERVER_EMAIL is root@localhost. But many of email servers including my email provider do not accept emails from such suspicious addresses. They silently drop the emails.

Changing the sender email address to django@my-domain.com solved the problem. In settings.py:

SERVER_EMAIL = 'django@my-domain.com'
93
3/28/2014 5:07:45 PM

Licensed under: CC-BY-SA with attribution
Not affiliated with: Stack Overflow
Icon