jhillyerd / enmime

MIME mail encoding and decoding package for Go

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Line wrap plain text and HTML parts

jhillyerd opened this issue · comments

enmime does not enforce a line-length on text parts. It should wrap the content in a way that preserves the original bytes upon decoding.

commented

So it looks like there is a hard-limit at 998 characters per line, but a suggested soft-limit at 78 characters per line (excluding CRLF line termination)

RFC-5322:

2.3. Body

The body of a message is simply lines of US-ASCII characters. The
only two limitations on the body are as follows:

o CR and LF MUST only occur together as CRLF; they MUST NOT appear
independently in the body.
o Lines of characters in the body MUST be limited to 998 characters,
and SHOULD be limited to 78 characters, excluding the CRLF.

Note: As was stated earlier, there are other documents,
specifically the MIME documents ([RFC2045], [RFC2046], [RFC2049],
[RFC4288], [RFC4289]), that extend (and limit) this specification
to allow for different sorts of message bodies. Again, these
mechanisms are beyond the scope of this document.

I'd definitely prefer to respect the 78 char limit. It would be annoying to "view source" in an email client and get a massively wide window to scroll around.

commented

Yeah, at 78-char wide it would look nice and tidy when you scroll by the base64 (72-char wide blocks)

commented

@jhillyerd I was looking at https://github.com/yosssi/gohtml as a drop in for satisfying the HTML line wrapping requirement.

There is still more work to be done implementing format=flowed for text/plain