| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
Sorry, something went wrong.
Pass False to send the message as an exact sequence of octets, without rewriting bare CR or LF to CRLF. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Documentation build overview3 files changed ± c-api/module.html ± library/imaplib.html ± whatsnew/changelog.html |
Sorry, something went wrong.
Read the APPEND literal by its octet count and verify that a serialized email message with bare LF is sent verbatim when translate_line_endings is false. Document using email.policy.SMTP for that case. Co-authored-by: harjoth <harjoth.khara@gmail.com> Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
…slate-newlines # Conflicts: # Lib/test/test_imaplib.py
| Back | FazBrowse Home | New Git URL |
IMAP4.append() rewrote every bare CR or LF in the message to CRLF
(MapCRLF.sub(CRLF, message)) before sending it as the APPEND literal.
But an IMAP literal is "a sequence of octets (including CR and LF)"
(:rfc:3501), and the protocol framing -- the octet count and the
trailing CRLF -- is handled separately by _command(), so rewriting the
payload silently corrupts the caller's message (for example, content with
intentional bare CR or LF, reported back in 2009).
This adds a keyword-only translate_line_endings parameter. It defaults
to True, preserving the previous behavior; passing False sends the
message literal exactly as given.
smtplib is intentionally left unchanged: it transmits the message as
CRLF-terminated lines in the DATA command (:rfc:5321), where
normalization is required for correct framing -- unlike an octet-counted
IMAP literal.