diff --git a/django/core/mail/backends/locmem.py b/django/core/mail/backends/locmem.py
index 642bfc4..6826d09 100644
a
|
b
|
class EmailBackend(BaseEmailBackend):
|
20 | 20 | |
21 | 21 | def send_messages(self, messages): |
22 | 22 | """Redirect messages to the dummy outbox""" |
| 23 | for message in messages: # .message() triggers header validation |
| 24 | message.message() |
23 | 25 | mail.outbox.extend(messages) |
24 | 26 | return len(messages) |
diff --git a/tests/regressiontests/mail/tests.py b/tests/regressiontests/mail/tests.py
index 3e9ae84..833a9e9 100644
a
|
b
|
class MailTests(TestCase):
|
288 | 288 | self.assertEqual(len(connection.test_outbox), 1) |
289 | 289 | self.assertEqual(connection.test_outbox[0].subject, '[Django] Manager message') |
290 | 290 | |
| 291 | @override_settings( |
| 292 | EMAIL_BACKEND='django.core.mail.backends.locmem.EmailBackend', |
| 293 | ) |
| 294 | def test_validate_multiline_headers(self): |
| 295 | # Ticket #18861 - Validate emails when using the locmem backend |
| 296 | with self.assertRaises(BadHeaderError): |
| 297 | send_mail('Subject\nMultiline', 'Content', 'from@example.com', ['to@example.com']) |
| 298 | |
291 | 299 | def test_dont_mangle_from_in_body(self): |
292 | 300 | # Regression for #13433 - Make sure that EmailMessage doesn't mangle |
293 | 301 | # 'From ' in message body. |