Reputation: 320
i noticed about to change the subject for django error reporting emails, is it possible to change subject? can we modify the subject for Django error reporting emails ?
Upvotes: 9
Views: 2323
Reputation: 5660
You need to set the EMAIL_SUBJECT_PREFIX
variable in your Django settings file.
https://docs.djangoproject.com/en/1.8/ref/settings/#email-subject-prefix
EMAIL_SUBJECT_PREFIX
Default:
'[Django] '
Subject-line prefix for email messages sent with
django.core.mail.mail_admins
ordjango.core.mail.mail_managers
. You’ll probably want to include the trailing space.
If you don't like Django error emails and want a better way of handling them, take a look a Sentry.
Upvotes: 18
Reputation: 61
If you need it only for reporting errors the best choice would be to inherit from the django.utils.log.AdminEmailHandler
and override the def format_subject(self, subject):
method.
Note that changing EMAIL_SUBJECT_PREFIX
will affect not only error emails but all emails send to admins including system information emails or so.
Upvotes: 5