- Feature: Add XOAUTH2 authentication support
- BREAKING: Drop Python 3.9 support
- Bugfix: correct aexit signature to comply with async context manager protocol (thanks @oliverlambson)
- Bugfix: Always clear the connect lock on connection lost, allowing client reconnect
- BREAKING: Drop Python 3.8 support
- Bugfix: Run socket.getfqdn in thread to avoid blocking event loop if local_hostname not provided (thanks @Raidzin)
- Bugfix: Clear connect lock on connection lost, allowing client reconnect
- Bugfix: Allow socket connections to use TLS by providing hostname and use_tls=True
- Bugfix: Type of "send" is partially unknown with pyright
- Bugfix: Fix asyncio deadlock trying to reconnect after error (thanks @Voldemat)
- Change: Switched from Poetry to build/hatch/twine for packaging.
- Bugfix: 'Future exception was never retrieved' warning in SMTPProtocol after successful connection close and garbage collection.
- Cleanup: Updated FlowControlMixin logic from stdlib
- BREAKING: Drop Python 3.7 support.
- BREAKING: Positional arguments are now positional only, and keyword arguments are keyword only.
- BREAKING: Passing
source_addressas a string argument (deprecated in 2.0) is now an error.source_addresstakes a (addr, port) tuple that is used as thelocal_addrparam ofasyncio.create_connection, allowing for binding to a specific IP. Thelocal_hostnameargument takes the value to be sent to the server with the EHLO/HELO message (which is whatsource_addresswas used for prior to 2.0). - Change: don't use timeout value passed to
connecteverywhere, only for the initial connection (credit @wombatonfire) - Change: removed unnecessary connection lost callback
- Change: revised handling for 'Future exception was never retrieved' warnings in protocol
- Bugfix: don't send extra EHLO/HELO before QUIT (credit @ikrivosheev)
- Change: added SMTPConnectionResponseError for invalid response on connect only (credit @ikrivosheev)
- Bugfix: "tests" and "docs" in the sdist should be includes, not packages,
so that they do not get put in
site-packages.
BREAKING: Drop Python 3.5 and 3.6 support.
BREAKING: On connect, if the server supports STARTTLS, automatically try to upgrade the connection. STARTTLS after connect can be turned on or off explicitly by passing
start_tls=Trueorstart_tls=Falserespectively.BREAKING: Remove deprecated
loopkeyword argument for the SMTP class.Change: The
source_addressargument now takes a (addr, port) tuple that is passed as thelocal_addrparam toasyncio.create_connection, allowing for binding to a specific IP. The newlocal_hostnameargument that takes the value to be sent to the server with the EHLO/HELO message. This behaviour more closely matchessmtplib.In order to not break existing usage, passing a string instead of a tuple to
source_addresswill give a DeprecationWarning, and use the value as it if had been passed forlocal_hostname.Thanks @rafaelrds and @davidmcnabnz for raising and contributing work on this issue.
Bugfix: the
mail_optionsandrcpt_optionsarguments to thesendcoroutine no longer cause errorsCleanup: Refactored
SMTPparent classes to remove complex inheritance structure.Cleanup: Switched to
asyncio.runfor sync client methods.Cleanup: Don't use private email.message.Message policy attribute (instead, set an appropriate policy based on message class)
Security: Fix a possible injection vulnerability (a variant of https://consensys.net/diligence/vulnerabilities/python-smtplib-multiple-crlf-injection/)
Note that in order to exploit this vulnerability in aiosmtplib, the attacker would need control of the
hostnameorsource_addressparameters. Thanks Sam Sanoop @ Snyk for bringing this to my attention.Bugfix: include CHANGLOG in sdist release
Type hints: fix type hints for async context exit (credit @JelleZijlstra)
- Bugfix: fix authenticated test failures (credit @P-EB)
- Bugfix: avoid raising
asyncio.CancelledErroron connection lost - Bugfix: allow UTF-8 chars in usernames and password strings
- Feature: allow bytes type args for login usernames and passwords
- Bugfix: parsing comma separated addresses in to header (credit @gjcarneiro)
- Feature: add py.typed file (PEP 561, credit @retnikt)
- Feature: add pause and resume writing methods to
SMTPProcotol, viaasyncio.streams.FlowControlMixin(thanks @ikrivosheev). - Bugfix: allow an empty sender (credit @ikrivosheev)
- Cleanup: more useful error message when login called without TLS
- Bugfix: removed
docsandtestsfrom wheel, they should only be in the source distribution.
- Bugfix: Fix handling of sending legacy email API (Message) objects.
- Bugfix: Fix SMTPNotSupported error with UTF8 sender/recipient names on servers that don't support SMTPUTF8.
- Feature: Added send coroutine api.
- Feature: Added SMTPUTF8 support for UTF8 chars in addresses.
- Feature: Added connected socket and Unix socket path connection options.
- Feature: Wait until the connect coroutine is awaited to get the event loop. Passing an explicit event loop via the loop keyword argument is deprecated and will be removed in version 2.0.
- Cleanup: Set context for timeout and connection exceptions properly.
- Cleanup: Use built in start_tls method on Python 3.7+.
- Cleanup: Timeout correctly if TLS handshake takes too long on Python 3.7+.
- Cleanup: Updated SMTPProcotol class and removed StreamReader/StreamWriter usage to remove deprecation warnings in 3.8.
- Bugfix: EHLO/HELO if required before any command, not just when using higher level commands.
- Cleanup: Replaced asserts in functions with more useful errors (e.g. RuntimeError).
- Cleanup: More useful error messages for timeouts (thanks ikrivosheev!),
including two new exception classes,
SMTPConnectTimeoutErrorandSMTPReadTimeoutError
- Bugfix: Set default timeout to 60 seconds as per documentation (previously it was unlimited).
- Bugfix: Connection is now closed if an error response is received immediately after connecting.
- Bugfix: Badly encoded server response messages are now decoded to utf-8, with error chars escaped.
- Cleanup: Removed handling for exceptions not raised by asyncio (in SMTPProtocol._readline)
- Bugfix: Removed buggy close connection on __del__
- Bugfix: Fixed old style auth method parsing in ESMTP response.
- Bugfix: Cleanup transport on exception in connect method.
- Cleanup: Simplified SMTPProtocol.connection_made, __main__
- Bugfix: Close connection lock on on SMTPServerDisconnected
- Feature: Added cert_bundle argument to connection init, connect and starttls methods
- Bugfix: Disconnected clients would raise SMTPResponseException: (-1 ...) instead of SMTPServerDisconnected
- Bugfix: Commands were getting out of order when using the client as a context manager within a task
- Bugfix: multiple tasks calling connect would get confused
- Bugfix: EHLO/HELO responses were being saved even after disconnect
- Bugfix: RuntimeError on client cleanup if event loop was closed
- Bugfix: CRAM-MD5 auth was not working
- Bugfix: AttributeError on STARTTLS under uvloop
Initial feature complete release with stable API; future changes will be documented here.