From da82939e5a31dea21a4f4d5085dfcd449fcbed3a Mon Sep 17 00:00:00 2001 From: Jon Dufresne Date: Fri, 8 Dec 2017 19:28:34 -0800 Subject: Fixed #28912 -- Made EmailMessage.message() omit an empty To header. --- tests/mail/tests.py | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'tests') diff --git a/tests/mail/tests.py b/tests/mail/tests.py index c7b8d09027..68a15311dc 100644 --- a/tests/mail/tests.py +++ b/tests/mail/tests.py @@ -85,6 +85,10 @@ class MailTests(HeadersCheckMixin, SimpleTestCase): self.assertEqual(message['From'], 'from@example.com') self.assertEqual(message['To'], 'to@example.com, other@example.com') + def test_header_omitted_for_no_to_recipients(self): + message = EmailMessage('Subject', 'Content', 'from@example.com', cc=['cc@example.com']).message() + self.assertNotIn('To', message) + def test_recipients_with_empty_strings(self): """ Empty strings in various recipient arguments are always stripped -- cgit v1.3