write base64 message parts with 76 data bytes on a line instead of 78

As required by RFC 2045 (MIME). The 78 byte lines work in practice, except that
SpamAssassin has rules that give messages with 78-byte lines spam points.

Mentioned by kjetilho on irc.
This commit is contained in:
Mechiel Lukkien
2025-04-03 10:22:15 +02:00
parent 00c8db98e6
commit 69d2699961
9 changed files with 16 additions and 13 deletions

View File

@ -64,7 +64,7 @@ func TestCompressBreak(t *testing.T) {
tcheck(t, err, "read random")
text := base64.StdEncoding.EncodeToString(buf)
for len(text) > 0 {
n := min(78, len(text))
n := min(76, len(text))
msg += text[:n] + "\r\n"
text = text[n:]
}