django/tests/mail
Mike Edmunds 23529b6627
Some checks failed
Linters / black (push) Has been cancelled
Linters / flake8 (push) Has been cancelled
Linters / isort (push) Has been cancelled
Tests / Windows, SQLite, Python 3.13 (push) Has been cancelled
Tests / JavaScript tests (push) Has been cancelled
Fixed #36478 -- Fixed inconsistent mail attachment handling.
Fixed an inconsistency between EmailMessage.attach() and .attachments
when attaching bytes content with a text/* mimetype. The attach()
function decodes UTF-8 bytes if possible and otherwise changes the
mimetype to application/octet-stream to preserve the content's unknown
encoding (refs #27007). Providing equivalent content directly in
EmailMessage.attachments did not apply the same logic, leading
to an "AttributeError: 'bytes' object has no attribute 'encode'"
in SafeMIMEText.set_payload().

Updated EmailMessage._create_mime_attachment() to match attach()'s
handling for text/* mimetypes with bytes content. Updated test cases
to accurately cover behavior on both paths.
2025-06-26 08:54:01 +02:00
..
attachments Fixed #27848 -- Prevented crash when attaching a .eml file to a message 2017-04-01 16:19:03 +02:00
__init__.py Removed unneeded imports in tests's __init__.py and unified them. 2013-09-09 23:01:07 +02:00
custombackend.py Fixed CVE-2024-45231 -- Avoided server error on password reset when email sending fails. 2024-09-03 09:22:32 -03:00
test_sendtestemail.py Fixed #36138 -- Changed ADMINS and MANAGERS settings to lists of strings. 2025-03-21 10:17:57 +01:00
tests.py Fixed #36478 -- Fixed inconsistent mail attachment handling. 2025-06-26 08:54:01 +02:00