summaryrefslogtreecommitdiff
path: root/django/core/mail/backends
AgeCommit message (Collapse)Author
2025-07-25Fixed #35581 -- Updated django.core.mail to Python's modern email API.Mike Edmunds
- Changed EmailMessage.message() to construct a "modern email API" email.message.EmailMessage and added policy keyword arg. - Added support for modern MIMEPart objects in EmailMessage.attach() (and EmailMessage constructor, EmailMessage.attachments list). - Updated SMTP EmailBackend to use modern email.policy.SMTP. Deprecated: - Attaching MIMEBase objects (replace with MIMEPart) - BadHeaderError (modern email uses ValueError) - SafeMIMEText, SafeMIMEMultipart (unnecessary for modern email) - django.core.mail.forbid_multi_line_headers() (undocumented, but exposed via `__all__` and in wide use) - django.core.mail.message.sanitize_address() (undocumented, but in wide use) Removed without deprecation (all undocumented): - EmailMessage.mixed_subtype - EmailMultiAlternatives.alternative_subtype - Support for setting (undocumented) EmailMessage.encoding property to a legacy email.charset.Charset object Related changes: - Dropped tests for incorrect RFC 2047 encoding of non-ASCII email address localparts. This is specifically prohibited by RFC 2047, and not supported by any known MTA or email client. (Python still mis-applies encoded-word to non-ASCII localparts, but it is a bug that may be fixed in the future.) - Added tests that try to discourage using Python's legacy email APIs in future updates to django.core.mail.
2024-01-26Applied Black's 2024 stable style.Mariusz Felisiak
https://github.com/psf/black/releases/tag/24.1.0
2023-10-25Fixed #34904 -- Prevented mutating sent emails from outbox in locmem email ↵sindre
backend.
2023-03-14Improved connection clean-up for SMTP backend.Carlton Gibson
2023-03-06Fixed #34386 -- Made SMTP backend load default system root CA certificates ↵Dmitriy Sintsov
by default. Regression in 2848e5d0ce5cf3c31fe87525536093b21d570f69.
2022-11-16Refs #34118 -- Used smtplib's context parameter instead of keyfile and certfile.Mariusz Felisiak
keyfile and certfile parameters were removed in Python 3.12, see https://github.com/python/cpython/commit/ef0e72b31d22f780d3a165d7d0471806061fe380
2022-02-07Refs #33476 -- Reformatted code with Black.django-bot
2019-11-06Refs #29983 -- Added pathlib.Path support to the file email backend.Jon Dufresne
2019-01-31Fixed #30147 -- Simplified directory creation with os.makedirs(..., ↵Jon Dufresne
exist_ok=True).
2019-01-28Fixed #30137 -- Replaced OSError aliases with the canonical OSError.Jon Dufresne
Used more specific errors (e.g. FileExistsError) as appropriate.
2018-12-26Fixed #30058 -- Made SMTP EmailBackend.send_messages() return 0 for ↵Denis Stebunov
empty/error cases.
2017-11-06Fixed #28776 -- Fixed a/an/and typos in docs and comments.Дилян Палаузов
2017-06-01Sorted imports per isort 4.2.9.Tim Graham
2017-02-21Refs #27656 -- Updated django.core docstring verbs according to PEP 257.Anton Samarchyan
2017-02-01Refs #23919 -- Replaced kwargs.pop() with keyword-only arguments.Vytis Banaitis
2017-01-25Refs #23919 -- Replaced super(ClassName, self) with super().chillaranand
2017-01-20Refs #23919 -- Removed unneeded force_str callsClaude Paroz
2017-01-19Refs #23919 -- Stopped inheriting from object to define new style classes.Simon Charette
2017-01-18Refs #23919 -- Removed six.<various>_types usageClaude Paroz
Thanks Tim Graham and Simon Charette for the reviews.
2017-01-18Refs #23919 -- Removed six.PY2/PY3 usageClaude Paroz
Thanks Tim Graham for the review.
2016-12-23Refs #26487 -- Removed unneeded ehlo() calls in SMTP backend.Tim Graham
starttls(), login(), and other connection methods already call the method as needed.
2016-10-21Fixed #27368 -- Modifed BaseEmailBackend.__enter__() to close the connection ↵Jon Dufresne
if an exception occurs. Fixes unclosed socket ResourceWarning in mail test. Thanks Claude Paroz for the review.
2016-10-05Removed unused variable in django/core/mail/backends/smtp.py.Tim Graham
2016-09-27Fixed #27210 -- Allowed SMTPBackend to fail silently on a socket connection ↵Vesteinn Snaebjarnarson
error.
2016-09-21Fixed #26210 -- Prevented SMTP backend from trying to send mail after a ↵levental
connection failure.
2016-08-31Fixed #27131 -- Passed proper string type to SMTP connection loginClaude Paroz
Passing an Unicode string on Python 2 was crashing the connection. Thanks slavugan@gmail.com for the report, and Tim Graham for the review.
2016-08-08Fixed #27036 -- Made locmem email backend's send_messages() accept generators.Antoine Fontaine
2016-05-06Fixed #25986 -- Fixed crash sending email with non-ASCII in local part of ↵Sergei Maertens
the address. On Python 3, sending emails failed for addresses containing non-ASCII characters due to the usage of the legacy Python email.utils.formataddr() function. This is fixed by using the proper Address object on Python 3.
2015-02-06Sorted imports with isort; refs #23860.Tim Graham
2014-10-12Fixed #23063 -- Convert \n and \r to \r\n when using the SMTP backend as per ↵Florian Apolloner
RFC.
2014-09-13Fixed #23461 -- Added EMAIL_TIMEOUT settingJosé Padilla
2014-09-10Fixed #20743 -- Added support for keyfile/certfile in SMTP connections.Andi Albrecht
Thanks jwmayfield, serg.partizan, and Wojciech Banaś for work on the patch.
2014-09-05Limited lines to 119 characters in django/Tim Graham
refs #23395.
2014-03-31Fixed #22327 -- Turned BaseEmailBackend into a context managerDaniel Neuhäuser
Changed the BaseEmailBackend to allow usage as context manager to open and close connections.
2014-01-12Undelete the `return True` removed in 4e0a2fe.Marc Tamlyn
This is quite important otherwise we don't close our connections to the SMTP server.
2013-12-30Decode mails using the message encoding.Florian Apolloner
2013-12-30Changed console and filebackend to use msg.as_bytes to output the data as it ↵Florian Apolloner
would get send via smtp.
2013-12-28Introduced as_bytes for SafeMIMEText (and other SafeMIME-classes).Florian Apolloner
This is to provide a consistent interface (namely bytes) for the smtp backend which after all sends bytes over the wire; encoding with as_string yields different results since mails as unicode are not really specified. as_string stays for backwardscompatibilty mostly and some debug outputs. But keep in mind that the output doesn't match as_bytes!
2013-11-02More attacking E302 violatorsAlex Gaynor
2013-10-25Undelete the login() call inadvertantly removed in 4e0a2fe59cClaude Paroz
Refs #21271.
2013-10-24Fixed #21271 -- Added timeout parameter to SMTP EmailBackend.SusanTan
Thanks Tobias McNulty and Tim Graham for discussions and code review. Thanks Andre Cruz the suggestion and initial patch.
2013-10-24Start attacking E231 violationsAlex Gaynor
2013-10-10Whitespace cleanup.Tim Graham
* Removed trailing whitespace. * Added newline to EOF if missing. * Removed blank lines at EOF. * Removed some stray tabs.
2013-10-05Fixed #21189: Cleaned up usage of bare except clauses.Baptiste Mispelon
Thanks to berkerpeksag for the report and to claudep for the review.
2013-09-10Fixed #20841 -- Added messages to NotImplementedErrorsGregor MacGregor
Thanks joseph at vertstudios.com for the suggestion.
2013-07-11Fixed #17471 -- Added smtplib.SMTP_SSL connection option for SMTP backendClaude Paroz
Thanks dj.facebook at gmail.com for the report and initial patch and Areski Belaid and senko for improvements.
2013-04-03Adds generators support for email backends that do not support it.Brendon Crawford
2013-01-03Replaced deprecated sslerror by ssl.SSLErrorClaude Paroz
The exact conditions on which this exception is raised are not known, but this replacement is the best guess we can do at this point.
2013-01-03Fixed #19382 -- Stopped smtp backend raising exception when already closedClaude Paroz
Thanks Sebastian Noack for the report and the initial patch.
2013-01-03Fixed #19134 -- Allowed closing smtp backend when the server is stoppedClaude Paroz
Thanks Sebastian Noack for the report and the initial patch.