diff --git a/django/core/mail/__init__.py b/django/core/mail/__init__.py
index d7a868d..8d06422 100644
a
|
b
|
def mail_admins(subject, message, fail_silently=False, connection=None):
|
87 | 87 | """Sends a message to the admins, as defined by the ADMINS setting.""" |
88 | 88 | if not settings.ADMINS: |
89 | 89 | return |
90 | | EmailMessage(settings.EMAIL_SUBJECT_PREFIX + subject, message, |
| 90 | EmailMessage(u'%s%s' % (settings.EMAIL_SUBJECT_PREFIX, subject), message, |
91 | 91 | settings.SERVER_EMAIL, [a[1] for a in settings.ADMINS], |
92 | 92 | connection=connection).send(fail_silently=fail_silently) |
93 | 93 | |
… |
… |
def mail_managers(subject, message, fail_silently=False, connection=None):
|
96 | 96 | """Sends a message to the managers, as defined by the MANAGERS setting.""" |
97 | 97 | if not settings.MANAGERS: |
98 | 98 | return |
99 | | EmailMessage(settings.EMAIL_SUBJECT_PREFIX + subject, message, |
| 99 | EmailMessage(u'%s%s' % (settings.EMAIL_SUBJECT_PREFIX, subject), message, |
100 | 100 | settings.SERVER_EMAIL, [a[1] for a in settings.MANAGERS], |
101 | 101 | connection=connection).send(fail_silently=fail_silently) |
102 | 102 | |
diff --git a/tests/regressiontests/mail/tests.py b/tests/regressiontests/mail/tests.py
index b0c60d8..41e898c 100644
a
|
b
|
class MailTests(TestCase):
|
343 | 343 | settings.ADMINS = old_admins |
344 | 344 | settings.MANAGERS = old_managers |
345 | 345 | |
| 346 | def test_mail_prefix(self): |
| 347 | """Test prefix argument in manager/admin mail.""" |
| 348 | # Regression for #13494. |
| 349 | old_admins = settings.ADMINS |
| 350 | old_managers = settings.MANAGERS |
| 351 | settings.ADMINS = settings.MANAGERS = [('nobody','nobody@example.com')] |
| 352 | |
| 353 | mail_managers(ugettext_lazy('Subject'), 'Content') |
| 354 | self.assertEqual(len(mail.outbox), 1) |
| 355 | message = mail.outbox[0] |
| 356 | self.assertEqual(message.subject, '[Django] Subject') |
| 357 | |
| 358 | mail.outbox = [] |
| 359 | mail_admins(ugettext_lazy('Subject'), 'Content') |
| 360 | self.assertEqual(len(mail.outbox), 1) |
| 361 | message = mail.outbox[0] |
| 362 | self.assertEqual(message.subject, '[Django] Subject') |
| 363 | |
| 364 | settings.ADMINS = old_admins |
| 365 | settings.MANAGERS = old_managers |
| 366 | |