#35581: Upgrade django.core.mail to use Python's modern email API
-------------------------------------+-------------------------------------
Reporter: Mike | Owner: Mike Edmunds
Edmunds |
Type: | Status: assigned
Cleanup/optimization |
Component: Core | Version:
(Mail) |
Severity: Normal | Keywords: email, compat32
Triage Stage: | Has patch: 0
Unreviewed |
Needs documentation: 0 | Needs tests: 0
Patch needs improvement: 0 | Easy pickings: 0
UI/UX: 0 |
-------------------------------------+-------------------------------------
django.core.mail.EmailMessage currently uses
[https://docs.python.org/3/library/email.html#:~:text=email%3A%20Examples-,Legacy%20API%3A,-email.message.Message
Python's "legacy" email API]. Updating that code to Python's newer
[https://docs.python.org/3/library/email.html#:~:text=modern%20(unicode%20friendly)%20API%20of%20the%20email%20package
"modern" email API] would fix bugs and substantially simplify it.
[https://groups.google.com/g/django-developers/c/2zf9GQtjdIk django-
developers discussion]
The update should be mostly transparent for users of Django's documented
mail APIs, but will rework the internals of django.core.mail.message in
ways that may require changes to some third-party email backends and other
code that borrows undocumented (but popular) functions from that module.
In addition, parts of Django's mail test suite will need reworking to
avoid dependence on legacy implementation specifics.
Some relevant posts from django-developers:
* [https://groups.google.com/g/django-
developers/c/2zf9GQtjdIk/m/GWjimue9FAAJ Background and rationale] for
switching to Python's modern email API
* [https://groups.google.com/g/django-
developers/c/2zf9GQtjdIk/m/RcvARzp9BAAJ Proposed implementation details]
(some of these were modified in later discussion—in particular, we
[https://groups.google.com/g/django-
developers/c/2zf9GQtjdIk/m/4S7UekG4BAAJ don't expect to combine
EmailMultiAlternatives into EmailMessage] as part of this ticket, and we
[https://groups.google.com/g/django-
developers/c/2zf9GQtjdIk/m/LcBfqfizAAAJ won't deprecate MIMEBase
attachments] just yet)
* [https://groups.google.com/g/django-
developers/c/2zf9GQtjdIk/m/mKqz2OKtAAAJ Deprecation details] for the
documented BadHeaderError, SafeMIMEText and SafeMIMEMultipart, and the
undocumented forbid_multi_line_headers() and sanitize_address()
--
Ticket URL: <https://code.djangoproject.com/ticket/35581>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.
--
You received this message because you are subscribed to the Google Groups
"Django updates" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/django-updates/01070190897ab05c-8c32102d-4204-48a1-a178-b644bdae6df6-000000%40eu-central-1.amazonses.com.