7 Commits
Author SHA1 Message Date
dualfroz 124f69fae3 Describe this repository 2026-10-22 21:02:15 +02:00
dualfroz 5f8d078d57 Keep the charset label for 7-bit ISO-2022 header values
encodeHeader() fell back to us-ascii for any header value without 8-bit
chars, which mislabelled ISO-2022-JP text. Values containing ESC escape
sequences now keep the message charset.

Fixes #2185
2026-10-14 18:51:49 +02:00
dualfroz 4ce8260f80 Spell out the folding arithmetic in addrAppend()
Name the separators that make up the line length instead of the bare
3, and refer to RFC 2822 like MAX_LINE_LENGTH does.
2026-10-03 18:30:36 +02:00
dualfroz 1ac61eecb6 Fold the To list passed to mail()
mailSend() joined the To addresses for mail() with its own implode, so
a long list still went out as one line, while the To header used for
getSentMIMEMessage() and DKIM signing is folded by addrAppend(). mail()
keeps CRLF + space folds in its to argument, so build it with
addrAppend() too.
2026-10-04 12:54:41 +02:00
dualfroz 0825c8cc83 Don't send QUIT while DATA is in progress
If the connection is closed in the middle of a DATA command, for example
from a destructor after SIGTERM, the server takes QUIT as part of the
message and the connection only ends when it times out. SMTP now keeps
the last command it sent in a state property, and quit() just closes the
connection when that command is DATA, as discussed in #3121.

Fixes #2994
2026-10-02 16:51:33 +02:00
dualfroz 94041263a0 Fold long address headers
addrAppend() joined all addresses onto one line, so a To, Cc, Bcc or
Reply-To header with many recipients could go past the 998 character
limit in RFC 5322. Fold between addresses when the next one would not
fit. Short lists are unchanged.

Fixes #2690
2026-10-02 16:44:53 +02:00
dualfroz 709e2d5b62 Normalise line breaks in S/MIME signed messages
openssl_pkcs7_sign() returns its headers and body with bare LF line
breaks. They were copied into the message verbatim, so signed mail was
rejected by SMTP servers that enforce RFC 5321 line endings with
550 5.6.11 SMTPSEND.BareLinefeedsAreIllegal.

Fixes #3067
2026-09-10 08:11:24 +02:00