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..33898cc 100644
a
|
b
|
class LocmemBackendTests(BaseEmailBackendTests, TestCase):
|
498 | 498 | connection2.send_messages([email]) |
499 | 499 | self.assertEqual(len(mail.outbox), 2) |
500 | 500 | |
| 501 | def test_validate_multiline_headers(self): |
| 502 | # Ticket #18861 - Validate emails when using the locmem backend |
| 503 | with self.assertRaises(BadHeaderError): |
| 504 | send_mail('Subject\nMultiline', 'Content', 'from@example.com', ['to@example.com']) |
| 505 | |
501 | 506 | |
502 | 507 | class FileBackendTests(BaseEmailBackendTests, TestCase): |
503 | 508 | email_backend = 'django.core.mail.backends.filebased.EmailBackend' |