| 1 |
Changelog |
| 2 |
========= |
| 3 |
|
| 4 |
5.1.3 |
| 5 |
----- |
| 6 |
|
| 7 |
- Security: reject addresses containing whitespace or angle brackets outside of a |
| 8 |
quoted local part in ``mail``, ``rcpt``, ``vrfy``, ``expn`` and ``sendmail``. |
| 9 |
Previously, a caller supplied address such as |
| 10 |
``[email protected]> AUTH=<[email protected]`` could smuggle additional ESMTP |
| 11 |
parameters onto the command line. This is a follow up to the fix in 5.1.1 for |
| 12 |
CVE-2026-53533 (GHSA-v3q9-hj7j-63hq), which only rejected control characters. |
| 13 |
``sendmail`` now validates all addresses before sending any commands. |
| 14 |
- Bugfix: reject ``local_hostname`` values (and the ``hostname`` argument to |
| 15 |
``helo``/``ehlo``) containing whitespace or control characters, so a hostname |
| 16 |
such as ``me.example.com XCLIENT ADDR=1.2.3.4`` can no longer smuggle extra |
| 17 |
parameters onto the EHLO/HELO command line. Surrounding whitespace is stripped. |
| 18 |
- Bugfix: raise ``SMTPAuthenticationError`` instead of ``binascii.Error`` when the |
| 19 |
server sends a malformed (non-base64) CRAM-MD5 challenge, so ``login`` can fall |
| 20 |
back to the next auth method |
| 21 |
- Bugfix: prevent SMTP command/response desync from unsolicited server data (thanks |
| 22 |
@Charisn for contributing) |
| 23 |
- Bugfix: handle protocol connection lost callback arriving after reconnect |
| 24 |
- Bugfix: close connection on async context manager exit in cases of a server error response |
| 25 |
- Bugfix: release connection lock on connect timeout |
| 26 |
- Bugfix: re-derive the default port on each ``connect()`` so changing |
| 27 |
``use_tls``/``start_tls`` between connects no longer reuses a stale default. |
| 28 |
Defaulted ``port``/``hostname`` are now resolved per-connect rather than |
| 29 |
written back onto the instance, so they read back as ``None`` when unset |
| 30 |
- Bugfix: typeerror in latest ty |
| 31 |
- Bugfix: mark response waiter exceptions as retrieved when they are set, so |
| 32 |
``Future exception was never retrieved`` is no longer logged on free-threaded |
| 33 |
builds where the previous ``__del__`` based cleanup ran too late |
| 34 |
- CI: test on free-threaded 3.14 and on 3.15 (standard and free-threaded) |
| 35 |
- Bugfix: the ``SIZE`` parameter sent with ``MAIL FROM`` now reports the number |
| 36 |
of octets as the message will be transmitted (with CRLF line endings), rather |
| 37 |
than the raw length of the message argument |
| 38 |
- Bugfix: data arriving on the transport after the connection is lost is now |
| 39 |
dropped instead of raising ``RuntimeError`` from the protocol callback |
| 40 |
- Bugfix: ``SMTPProtocol`` now records that it is using TLS after a successful |
| 41 |
``start_tls``, so a second upgrade attempt on the protocol is rejected |
| 42 |
- Bugfix: ``starttls`` now validates its TLS options before sending EHLO, so |
| 43 |
invalid options raise ``ValueError`` without touching the connection |
| 44 |
- Bugfix: ``helo`` no longer records a failed response as ``last_helo_response``, |
| 45 |
so a rejected HELO does not leave the session looking as if a greeting succeeded |
| 46 |
- Bugfix: ``bytearray`` and ``memoryview`` values are no longer silently passed |
| 47 |
through the auth encoding helpers; only ``str`` and ``bytes`` are accepted, as |
| 48 |
the type annotations already stated |
| 49 |
- Bugfix: TLS context setup now run in thread (thanks @tr4nt0r) |
| 50 |
|
| 51 |
|
| 52 |
5.1.2 |
| 53 |
----- |
| 54 |
|
| 55 |
- Security: Discard any buffered server data before the STARTTLS handshake, |
| 56 |
preventing a response-injection attack where a man-in-the-middle pre-stages |
| 57 |
plaintext that would otherwise be read as part of the encrypted session. |
| 58 |
More details: https://github.com/cole/aiosmtplib/security/advisories/GHSA-vxj7-4xrp-5vr4 |
| 59 |
- Bugfix: Corrected SMTPResponse ``__repr__`` result |
| 60 |
- Bugfix: Calling ``connect()`` on an already-connected client now raises |
| 61 |
``SMTPException`` instead of deadlocking on the connection lock |
| 62 |
- Feature: Poe command runner for dev tasks |
| 63 |
- Bugfix: Timeout ignored during CRAM-MD5 verification |
| 64 |
- Bugfix: Only parse EHLO response after validating success |
| 65 |
- Bugfix: return None from extract_sender when address list is empty |
| 66 |
- Bugfix: Enforce a maximum total response size, preventing unbounded memory |
| 67 |
use if a server streams data with no line ending or endless multiline |
| 68 |
continuation lines |
| 69 |
- Bugfix: Use the invalid_response status code (-1) instead of 500 when a |
| 70 |
server response line exceeds the maximum length |
| 71 |
- Bugfix: A read timeout now closes the connection instead of leaving it in a |
| 72 |
desynced state, where a late server response could be mispaired with a |
| 73 |
subsequent command |
| 74 |
- Bugfix: Correctly parse old-style ``AUTH=`` extension advertisements; all |
| 75 |
advertised methods are now kept (e.g. both PLAIN and LOGIN from |
| 76 |
``AUTH=PLAIN LOGIN``) |
| 77 |
- Bugfix: ESMTP extension lines with leading whitespace are no |
| 78 |
longer ignored |
| 79 |
|
| 80 |
|
| 81 |
5.1.1 |
| 82 |
----- |
| 83 |
|
| 84 |
- Security: Reject control characters (the C0 range ``0x00``-``0x1F`` and DEL |
| 85 |
``0x7F``, including CR, LF, and NUL) in SMTP command arguments, preventing |
| 86 |
command injection via input passed to ``mail()``, ``rcpt()``, ``vrfy()``, |
| 87 |
``expn()`` or ``sendmail()``. Such input now raises ``ValueError`` before |
| 88 |
anything is written to the connection. |
| 89 |
More details: https://github.com/cole/aiosmtplib/security/advisories/GHSA-v3q9-hj7j-63hq |
| 90 |
Thanks to @tonghuaroot for the report. |
| 91 |
- Bugfix: ``SMTP.quit()`` no longer hangs until the read timeout when the |
| 92 |
peer drops the transport with an exception after ``QUIT`` is sent but |
| 93 |
before the 221 reply is parsed (e.g. AWS SES closing TLS without |
| 94 |
``close_notify``). |
| 95 |
|
| 96 |
5.1.0 |
| 97 |
----- |
| 98 |
|
| 99 |
- Feature: Add XOAUTH2 authentication support |
| 100 |
|
| 101 |
|
| 102 |
5.0.0 |
| 103 |
----- |
| 104 |
|
| 105 |
- **BREAKING**: Drop Python 3.9 support |
| 106 |
|
| 107 |
|
| 108 |
4.0.2 |
| 109 |
----- |
| 110 |
|
| 111 |
- Bugfix: correct aexit signature to comply with async context manager protocol |
| 112 |
(thanks @oliverlambson) |
| 113 |
|
| 114 |
|
| 115 |
4.0.1 |
| 116 |
----- |
| 117 |
|
| 118 |
- Bugfix: Always clear the connect lock on connection lost, allowing client reconnect |
| 119 |
|
| 120 |
|
| 121 |
4.0.0 |
| 122 |
----- |
| 123 |
|
| 124 |
- **BREAKING**: Drop Python 3.8 support |
| 125 |
- Bugfix: Run `socket.getfqdn` in thread to avoid blocking event loop |
| 126 |
if `local_hostname` not provided (thanks @Raidzin) |
| 127 |
- Bugfix: Clear connect lock on connection lost, allowing client reconnect |
| 128 |
- Bugfix: Allow socket connections to use TLS by providing `hostname` and |
| 129 |
`use_tls=True` |
| 130 |
|
| 131 |
|
| 132 |
3.0.2 |
| 133 |
----- |
| 134 |
|
| 135 |
- Bugfix: Type of "send" is partially unknown with pyright |
| 136 |
- Bugfix: Fix asyncio deadlock trying to reconnect after error (thanks @Voldemat) |
| 137 |
- Change: Switched from Poetry to build/hatch/twine for packaging. |
| 138 |
|
| 139 |
|
| 140 |
3.0.1 |
| 141 |
----- |
| 142 |
|
| 143 |
- Bugfix: 'Future exception was never retrieved' warning in SMTPProtocol |
| 144 |
after successful connection close and garbage collection. |
| 145 |
- Cleanup: Updated FlowControlMixin logic from stdlib |
| 146 |
|
| 147 |
|
| 148 |
3.0.0 |
| 149 |
----- |
| 150 |
|
| 151 |
- **BREAKING**: Drop Python 3.7 support. |
| 152 |
- **BREAKING**: Positional arguments are now positional only, and keyword arguments |
| 153 |
are keyword only. |
| 154 |
- **BREAKING**: Passing ``source_address`` as a string argument (deprecated in 2.0) |
| 155 |
is now an error. ``source_address`` takes a (addr, port) tuple that is used as |
| 156 |
the ``local_addr`` param of ``asyncio.create_connection``, allowing for binding |
| 157 |
to a specific IP. The ``local_hostname`` argument takes the value to be sent to |
| 158 |
the server with the EHLO/HELO message (which is what ``source_address`` was used |
| 159 |
for prior to 2.0). |
| 160 |
- Change: don't use timeout value passed to ``connect`` everywhere, |
| 161 |
only for the initial connection (credit @wombatonfire) |
| 162 |
- Change: removed unnecessary connection lost callback |
| 163 |
- Change: revised handling for 'Future exception was never retrieved' warnings in |
| 164 |
protocol |
| 165 |
|
| 166 |
|
| 167 |
2.0.2 |
| 168 |
----- |
| 169 |
|
| 170 |
- Bugfix: don't send extra EHLO/HELO before QUIT (credit @ikrivosheev) |
| 171 |
- Change: added SMTPConnectionResponseError for invalid response on |
| 172 |
connect only (credit @ikrivosheev) |
| 173 |
|
| 174 |
2.0.1 |
| 175 |
----- |
| 176 |
|
| 177 |
- Bugfix: "tests" and "docs" in the sdist should be includes, not packages, |
| 178 |
so that they do not get put in ``site-packages``. |
| 179 |
|
| 180 |
|
| 181 |
2.0.0 |
| 182 |
----- |
| 183 |
|
| 184 |
- **BREAKING**: Drop Python 3.5 and 3.6 support. |
| 185 |
- **BREAKING**: On connect, if the server supports STARTTLS, automatically try |
| 186 |
to upgrade the connection. STARTTLS after connect can be turned on or off |
| 187 |
explicitly by passing ``start_tls=True`` or ``start_tls=False`` respectively. |
| 188 |
- **BREAKING**: Remove deprecated ``loop`` keyword argument for the SMTP class. |
| 189 |
- Change: The ``source_address`` argument now takes a (addr, port) tuple that is |
| 190 |
passed as the ``local_addr`` param to ``asyncio.create_connection``, allowing |
| 191 |
for binding to a specific IP. The new ``local_hostname`` argument that takes |
| 192 |
the value to be sent to the server with the EHLO/HELO message. This behaviour |
| 193 |
more closely matches ``smtplib``. |
| 194 |
|
| 195 |
In order to not break existing usage, passing a string instead of a tuple to |
| 196 |
``source_address`` will give a DeprecationWarning, and use the value as it if |
| 197 |
had been passed for ``local_hostname``. |
| 198 |
|
| 199 |
Thanks @rafaelrds and @davidmcnabnz for raising and contributing work on this |
| 200 |
issue. |
| 201 |
- Bugfix: the ``mail_options`` and ``rcpt_options`` arguments to the ``send`` |
| 202 |
coroutine no longer cause errors |
| 203 |
- Cleanup: Refactored ``SMTP`` parent classes to remove complex inheritance |
| 204 |
structure. |
| 205 |
- Cleanup: Switched to ``asyncio.run`` for sync client methods. |
| 206 |
- Cleanup: Don't use private email.message.Message policy attribute (instead, |
| 207 |
set an appropriate policy based on message class) |
| 208 |
|
| 209 |
|
| 210 |
1.1.7 |
| 211 |
----- |
| 212 |
|
| 213 |
- Security: Fix a possible injection vulnerability (a variant of |
| 214 |
https://consensys.net/diligence/vulnerabilities/python-smtplib-multiple-crlf-injection/) |
| 215 |
|
| 216 |
Note that in order to exploit this vulnerability in aiosmtplib, the attacker would need |
| 217 |
control of the ``hostname`` or ``source_address`` parameters. Thanks Sam Sanoop @ Snyk |
| 218 |
for bringing this to my attention. |
| 219 |
- Bugfix: include CHANGLOG in sdist release |
| 220 |
- Type hints: fix type hints for async context exit (credit @JelleZijlstra) |
| 221 |
|
| 222 |
|
| 223 |
1.1.6 |
| 224 |
----- |
| 225 |
|
| 226 |
- Bugfix: fix authenticated test failures (credit @P-EB) |
| 227 |
|
| 228 |
|
| 229 |
1.1.5 |
| 230 |
----- |
| 231 |
|
| 232 |
- Bugfix: avoid raising ``asyncio.CancelledError`` on connection lost |
| 233 |
- Bugfix: allow UTF-8 chars in usernames and password strings |
| 234 |
- Feature: allow bytes type args for login usernames and passwords |
| 235 |
|
| 236 |
|
| 237 |
1.1.4 |
| 238 |
----- |
| 239 |
|
| 240 |
- Bugfix: parsing comma separated addresses in to header (credit @gjcarneiro) |
| 241 |
- Feature: add py.typed file (PEP 561, credit @retnikt) |
| 242 |
|
| 243 |
|
| 244 |
1.1.3 |
| 245 |
----- |
| 246 |
|
| 247 |
- Feature: add pause and resume writing methods to ``SMTPProcotol``, via |
| 248 |
``asyncio.streams.FlowControlMixin`` (thanks @ikrivosheev). |
| 249 |
|
| 250 |
- Bugfix: allow an empty sender (credit @ikrivosheev) |
| 251 |
|
| 252 |
- Cleanup: more useful error message when login called without TLS |
| 253 |
|
| 254 |
|
| 255 |
1.1.2 |
| 256 |
----- |
| 257 |
|
| 258 |
- Bugfix: removed ``docs`` and ``tests`` from wheel, they should only be |
| 259 |
in the source distribution. |
| 260 |
|
| 261 |
|
| 262 |
1.1.1 |
| 263 |
----- |
| 264 |
|
| 265 |
- Bugfix: Fix handling of sending legacy email API (Message) objects. |
| 266 |
|
| 267 |
- Bugfix: Fix SMTPNotSupported error with UTF8 sender/recipient names |
| 268 |
on servers that don't support SMTPUTF8. |
| 269 |
|
| 270 |
|
| 271 |
1.1.0 |
| 272 |
----- |
| 273 |
|
| 274 |
- Feature: Added send coroutine api. |
| 275 |
|
| 276 |
- Feature: Added SMTPUTF8 support for UTF8 chars in addresses. |
| 277 |
|
| 278 |
- Feature: Added connected socket and Unix socket path connection options. |
| 279 |
|
| 280 |
- Feature: Wait until the connect coroutine is awaited to get the event loop. |
| 281 |
Passing an explicit event loop via the loop keyword argument is deprecated |
| 282 |
and will be removed in version 2.0. |
| 283 |
|
| 284 |
- Cleanup: Set context for timeout and connection exceptions properly. |
| 285 |
|
| 286 |
- Cleanup: Use built in start_tls method on Python 3.7+. |
| 287 |
|
| 288 |
- Cleanup: Timeout correctly if TLS handshake takes too long on Python 3.7+. |
| 289 |
|
| 290 |
- Cleanup: Updated SMTPProcotol class and removed StreamReader/StreamWriter |
| 291 |
usage to remove deprecation warnings in 3.8. |
| 292 |
|
| 293 |
- Bugfix: EHLO/HELO if required before any command, not just when using |
| 294 |
higher level commands. |
| 295 |
|
| 296 |
- Cleanup: Replaced asserts in functions with more useful errors (e.g. |
| 297 |
RuntimeError). |
| 298 |
|
| 299 |
- Cleanup: More useful error messages for timeouts (thanks ikrivosheev!), |
| 300 |
including two new exception classes, ``SMTPConnectTimeoutError`` and |
| 301 |
``SMTPReadTimeoutError`` |
| 302 |
|
| 303 |
|
| 304 |
1.0.6 |
| 305 |
----- |
| 306 |
|
| 307 |
- Bugfix: Set default timeout to 60 seconds as per documentation |
| 308 |
(previously it was unlimited). |
| 309 |
|
| 310 |
|
| 311 |
1.0.5 |
| 312 |
----- |
| 313 |
|
| 314 |
- Bugfix: Connection is now closed if an error response is received |
| 315 |
immediately after connecting. |
| 316 |
|
| 317 |
|
| 318 |
1.0.4 |
| 319 |
----- |
| 320 |
|
| 321 |
- Bugfix: Badly encoded server response messages are now decoded to utf-8, |
| 322 |
with error chars escaped. |
| 323 |
|
| 324 |
- Cleanup: Removed handling for exceptions not raised by asyncio (in |
| 325 |
SMTPProtocol._readline) |
| 326 |
|
| 327 |
|
| 328 |
1.0.3 |
| 329 |
----- |
| 330 |
|
| 331 |
- Bugfix: Removed buggy close connection on __del__ |
| 332 |
|
| 333 |
- Bugfix: Fixed old style auth method parsing in ESMTP response. |
| 334 |
|
| 335 |
- Bugfix: Cleanup transport on exception in connect method. |
| 336 |
|
| 337 |
- Cleanup: Simplified SMTPProtocol.connection_made, __main__ |
| 338 |
|
| 339 |
|
| 340 |
1.0.2 |
| 341 |
----- |
| 342 |
|
| 343 |
- Bugfix: Close connection lock on on SMTPServerDisconnected |
| 344 |
|
| 345 |
- Feature: Added cert_bundle argument to connection init, connect and starttls |
| 346 |
methods |
| 347 |
|
| 348 |
- Bugfix: Disconnected clients would raise SMTPResponseException: (-1 ...) |
| 349 |
instead of SMTPServerDisconnected |
| 350 |
|
| 351 |
|
| 352 |
1.0.1 |
| 353 |
----- |
| 354 |
|
| 355 |
- Bugfix: Commands were getting out of order when using the client as a context |
| 356 |
manager within a task |
| 357 |
|
| 358 |
- Bugfix: multiple tasks calling connect would get confused |
| 359 |
|
| 360 |
- Bugfix: EHLO/HELO responses were being saved even after disconnect |
| 361 |
|
| 362 |
- Bugfix: RuntimeError on client cleanup if event loop was closed |
| 363 |
|
| 364 |
- Bugfix: CRAM-MD5 auth was not working |
| 365 |
|
| 366 |
- Bugfix: AttributeError on STARTTLS under uvloop |
| 367 |
|
| 368 |
|
| 369 |
1.0.0 |
| 370 |
----- |
| 371 |
|
| 372 |
Initial feature complete release with stable API; future changes will be |
| 373 |
documented here. |