summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
Diffstat (limited to 'tests')
-rw-r--r--tests/mail/tests.py12
1 files changed, 12 insertions, 0 deletions
diff --git a/tests/mail/tests.py b/tests/mail/tests.py
index 7963b81892..01a37284c1 100644
--- a/tests/mail/tests.py
+++ b/tests/mail/tests.py
@@ -397,6 +397,18 @@ class EmailMessageTests(MailTestsMixin, SimpleTestCase):
self.assertNotIn("bcc@example.com", message.as_string())
self.assertEqual(email.recipients(), ["to@example.com", "bcc@example.com"])
+ def test_bcc_in_headers_raises_error(self):
+ email = EmailMessage(
+ to=["to@example.com"],
+ headers={"Bcc": "bcc@example.com"},
+ )
+ msg = (
+ 'Bcc is not a valid email header. Use the "bcc" argument to '
+ "specify blind carbon copy recipients."
+ )
+ with self.assertRaisesMessage(ValueError, msg):
+ email.message()
+
def test_reply_to(self):
with self.subTest("Single Reply-To"):
email = EmailMessage(