Open emersion opened 6 years ago
Not sure why we are also having trouble with this. DKIM seems to be failing when truncating at 1,000 character, but seems to be doing fine at 994.
wc = nopCloser{textwrapper.New(w, "\r\n", 1000)}
Think it might make more sense to check each individual line to see if its length is beyond 998 (or 1000) characters. Right now, it's introducing line-breaks every 1000 characters even though they are not really required.
Line breaks every 998 characters at most are required by the RFC.
Line breaks every 998 characters at most are required by the RFC.
Each line of characters MUST be no more than 998 characters, and SHOULD be no more than 78 characters, excluding the CRLF.
Yes, but the textwrapper seems to be doing every 998 characters. So if you've a 2,000 characters long email, it will split into two halves even though it may not be necessary. You only need to add a linebreak if a line is more than 998 characters.
Maybe I understand it incorrectly
Yeah, that's not related to this issue though. I would've sworn that we have another issue tracking this but can't find it anymore...
https://github.com/emersion/go-message/pull/176 should help with the issue you describe.
The algorithm mangling long lines is pretty messy. I'd rather not use it when not needed.
See https://tools.ietf.org/html/rfc5322#section-2.1.1