KVISH
KVISH

Reputation: 13208

Django emailing on errors

I have been struggling to get the emailing to work in Django for logging as well as for 500 and 404 errors and for the life of me I cant get it to work. I have DEBUG=False and all the other settings. I have the below for the email settings:

EMAIL_HOST = 'host'
EMAIL_PORT = 587
EMAIL_HOST_USER = 'username'
EMAIL_HOST_PASSWORD = 'password'
EMAIL_SUBJECT_PREFIX = 'something'
EMAIL_USE_TLS = True
SERVER_EMAIL='[email protected]'

I'm using Amazon SES for the above settings. I also have the following:

SEND_BROKEN_LINK_EMAILS=True
ADMINS = (
    ('name', 'email'),
)
MIDDLEWARE_CLASSES = (
    'django.middleware.common.CommonMiddleware',
    'django.contrib.sessions.middleware.SessionMiddleware',
    'django.middleware.csrf.CsrfViewMiddleware',
    'django.contrib.auth.middleware.AuthenticationMiddleware',
    'django.contrib.messages.middleware.MessageMiddleware',
    'django.middleware.csrf.CsrfViewMiddleware',
)

Is there anything else I'm missing?? Any help is appreciated.

Upvotes: 3

Views: 2671

Answers (1)

Intenex
Intenex

Reputation: 1947

Yep, it's not ADMINS = () that receives SEND_BROKEN_LINK_EMAILS, it's MANAGERS = ()

https://docs.djangoproject.com/en/dev/ref/settings/#managers

https://docs.djangoproject.com/en/dev/howto/error-reporting/#errors

Add this right under ADMINS and it should work:

MANAGERS = ADMINS

You may also want to specify EMAIL_BACKEND in settings, e.g. assuming SMTP:

EMAIL_BACKEND = 'django.core.mail.backends.smtp.EmailBackend'

https://docs.djangoproject.com/en/dev/ref/settings/#email-backend

Upvotes: 5

Related Questions