summaryrefslogtreecommitdiff
path: root/django/core/mail/backends/base.py
AgeCommit message (Collapse)Author
2026-05-13Fixed #35514 -- Implemented dictionary-based MAILERS.Mike Edmunds
See DEP 0018. Added: * MAILERS setting. * django.core.mail.mailers dict-like EmailBackend factory. * `using` argument to mail sending APIs. * `sent_using` attribute to mail.outbox messages in locmem backend. * MAILERS in startproject settings template, set to console backend. * AdminLogHandler.using argument. * BrokenLinkEmailsMiddleware.send_mail() method. Updated: * BaseEmailBackend to track the MAILERS alias used to construct it, and to report errors for unknown kwargs (OPTIONS). * EmailBackend implementations to initialize from kwargs (OPTIONS) only when MAILERS is being used. * smtp.EmailBackend to require `host` option and to default `port` option based on SSL/TLS options. * SimpleTestCase setup to substitute the locmem backend for all defined MAILERS configurations. * Django's tests that send mail to define MAILERS. Deprecated: * EMAIL_BACKEND and other backend-related EMAIL_* settings. * mail.get_connection(). * The `connection`, `fail_silently`, `auth_user`, and `auth_password` arguments to mail functions. * The EmailMessage.connection attribute. * BaseEmailBackend support for `fail_silently`. Backends that support fail_silently (SMTP, console, file) now implement it directly. * AdminEmailHandler.email_backend argument. Removed undocumented features without deprecation: * EmailMessage.get_connection() method. (send() now raises an error if a subclass has attempted to override it.) * EmailMessage.send() no longer sets self.connection to the connection used for sending. (It still _uses_ a pre-existing self.connection.) * AdminEmailHandler.connection() method. (Init now raises an error if a subclass has attempted to override it.) Thanks to Natalia Bidart for shepherding DEP 0018 and for extensive reviews and suggestions on the implementation. Thanks to Jacob Rief for the initial implementation and multiple iterations while refining the design. Co-authored-by: Jacob Rief <jacob.rief@gmail.com>
2022-02-07Refs #33476 -- Reformatted code with Black.django-bot
2017-02-21Refs #27656 -- Updated django.core docstring verbs according to PEP 257.Anton Samarchyan
2017-01-19Refs #23919 -- Stopped inheriting from object to define new style classes.Simon Charette
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.
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.
2013-11-02More attacking E302 violatorsAlex Gaynor
2013-09-10Fixed #20841 -- Added messages to NotImplementedErrorsGregor MacGregor
Thanks joseph at vertstudios.com for the suggestion.
2009-11-03Fixed #10355 -- Added an API for pluggable e-mail backends.Russell Keith-Magee
Thanks to Andi Albrecht for his work on this patch, and to everyone else that contributed during design and development. git-svn-id: http://code.djangoproject.com/svn/django/trunk@11709 bcc190cf-cafb-0310-a4f2-bffc1f526a37