summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--django/conf/global_settings.py4
-rw-r--r--django/core/mail.py6
2 files changed, 7 insertions, 3 deletions
diff --git a/django/conf/global_settings.py b/django/conf/global_settings.py
index 59edbcec70..9876713718 100644
--- a/django/conf/global_settings.py
+++ b/django/conf/global_settings.py
@@ -67,6 +67,10 @@ ADMIN_MEDIA_PREFIX = '/media/'
# the site managers.
DEFAULT_FROM_EMAIL = 'webmaster@localhost'
+# Subject-line prefix for email messages send with django.core.mail.mail_admins
+# or ...mail_managers. Make sure to include the trailing space.
+EMAIL_SUBJECT_PREFIX = '[Django] '
+
# Whether to append trailing slashes to URLs.
APPEND_SLASH = True
diff --git a/django/core/mail.py b/django/core/mail.py
index ec84ee3b3b..24a85d77f0 100644
--- a/django/core/mail.py
+++ b/django/core/mail.py
@@ -1,6 +1,6 @@
# Use this module for e-mailing.
-from django.conf.settings import DEFAULT_FROM_EMAIL, EMAIL_HOST
+from django.conf.settings import DEFAULT_FROM_EMAIL, EMAIL_HOST, EMAIL_SUBJECT_PREFIX
from email.MIMEText import MIMEText
import smtplib
@@ -41,9 +41,9 @@ def send_mass_mail(datatuple, fail_silently=False):
def mail_admins(subject, message, fail_silently=False):
"Sends a message to the admins, as defined by the ADMINS constant in settings.py."
from django.conf.settings import ADMINS, SERVER_EMAIL
- send_mail('[Django] ' + subject, message, SERVER_EMAIL, [a[1] for a in ADMINS], fail_silently)
+ send_mail(EMAIL_SUBJECT_PREFIX + subject, message, SERVER_EMAIL, [a[1] for a in ADMINS], fail_silently)
def mail_managers(subject, message, fail_silently=False):
"Sends a message to the managers, as defined by the MANAGERS constant in settings.py"
from django.conf.settings import MANAGERS, SERVER_EMAIL
- send_mail('[Django] ' + subject, message, SERVER_EMAIL, [a[1] for a in MANAGERS], fail_silently)
+ send_mail(EMAIL_SUBJECT_PREFIX + subject, message, SERVER_EMAIL, [a[1] for a in MANAGERS], fail_silently)