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

@ -875,7 +875,7 @@ func (s server) Send(ctx context.Context, req webapi.SendRequest) (resp webapi.S
for len(base64Data) > 0 {
line := base64Data
n := min(len(line), 78)
n := min(len(line), 76) // ../rfc/2045:1372
line, base64Data = base64Data[:n], base64Data[n:]
_, err := p.Write([]byte(line))
xcheckf(err, "writing attachment")