Skip to content

2.3.3

Choose a tag to compare

@github-actions github-actions released this 27 Oct 04:09
· 11 commits to master since this release
4155f1f
  • Add a starttls parameter to IMAPClient (and IMAPConnection, which passes it through, including to the connection its watch() loop opens) and to send_email() to control the STARTTLS upgrade of a plain-text connection (ssl=False for IMAP, require_encryption=False for SMTP). None (the default) keeps the existing behavior of upgrading whenever the server advertises STARTTLS; False never upgrades, so the connection stays plain text even when STARTTLS is advertised; True requires the upgrade and raises IMAPClientError (IMAP) or SMTPError (SMTP) if the server does not advertise STARTTLS. The value is ignored when ssl=True or require_encryption=True, because the connection is already TLS. Previously ssl=False and require_encryption=False could not opt out of the automatic upgrade, so a server advertising STARTTLS with a TLS setup the client rejects (such as a weak DH key) was unusable (Closes #65)
  • Fix MaildirConnection failing on messages that email can parse but not re-serialize (GHSA-9jx3-p8wm-g8vw, affects 2.0.0 through 2.3.2), such as a message/rfc822 part whose header contains \x1c (HeaderWriteError from CPython's CVE-2024-6923 header check) or a few hundred nested multipart parts (RecursionError). fetch_message(), mark_read, and move_message() all round-tripped the message through email.message, so a poison message could never be moved out of the way (the motivating case is parsedmarc GHSA-qxwv-2vwj-v828, where it could not be moved to the invalid-reports folder). fetch_message() now returns the stored bytes decoded as UTF-8 with replacement, like the IMAP backend; mark_read renames the file into cur/ with the S flag added; and move_message() renames the file into the destination folder's matching new//cur/ subdirectory, keeping its name and flags; if the destination already holds that key it raises mailbox.ExternalClashError instead of overwriting (previously the message was re-added under a fresh key). Well-formed messages now come back as the file's own text rather than as_string() output, which differs in two ways: CRLF line endings are preserved verbatim instead of being normalized to \n, and 8-bit bytes in headers decode to U+FFFD instead of being rewritten as =?unknown-8bit?q?...?= encoded words