10

Occasionally I've seen code wrapping email messages to make sure a single line is no more than 72 characters long. Is there really need for this and what is this all about?

skaffman
  • 398,947
  • 96
  • 818
  • 769
Tower
  • 98,741
  • 129
  • 357
  • 507
  • Good answer is here: http://stackoverflow.com/questions/2696433/is-it-necessary-to-wrap-long-lines-when-sending-emails/2696542#2696542 – Marco Demaio Jun 08 '11 at 15:24

2 Answers2

9

RFC 2822 contains this text about line lengths, which is where this likely comes from:

There are two limits that this standard places on the number of
characters in a line. Each line of characters MUST be no more than 998 characters, and SHOULD be no more than 78 characters, excluding the CRLF.

The 998 character limit is due to limitations in many implementations
which send, receive, or store Internet Message Format messages that simply cannot handle more than 998 characters on a line. Receiving
implementations would do well to handle an arbitrarily large number
of characters in a line for robustness sake. However, there are so many implementations which (in compliance with the transport requirements of [RFC2821]) do not accept messages containing more than 1000 character including the CR and LF per line, it is important for implementations not to create such messages.

The more conservative 78 character recommendation is to accommodate
the many implementations of user interfaces that display these
messages which may truncate, or disastrously wrap, the display of
more than 78 characters per line, in spite of the fact that such
implementations are non-conformant to the intent of this specification (and that of [RFC2821] if they actually cause information to be lost). Again, even though this limitation is put on messages, it is encumbant upon implementations which display messages

Joe
  • 41,484
  • 20
  • 104
  • 125
6

To expand on Joe's response, the 72-char limit basically allows for bodies to then be quoted, so it gives room for the additional chars added to a line, e.g.,

From "scratch":
> From Joe Bloggs, 24 Sept 1985
>
> > Probably some flame about emacs vs vi, eulogising one over the other.
> > The quote chars have added four characters to the start of the line, so
> > forcing wrapped lines at 72 chars pushes this to 76 chars, without
> > affecting the formatting of the paragraph.
> 
> Some rant accusing Joe of talking crap, and throwing out some random
> evidence to the contrary. Quote char adds 2 chars. Again, paragraph
> formatting retained.

Someone else chimes in deciding to eulogise pico over either of the
other two editors. All sides about to turn on this person. :-)

So giving an extra few chars allows the parapgraph formatting to be retained on 80-character terminals, for at least two levels, and potentially more depending on how the quote characters are added/used.

Chris J
  • 30,688
  • 6
  • 69
  • 111
  • 2
    Is this still necessary these days? – Tower Nov 28 '10 at 18:35
  • Probably not, as most email readers will wordwrap properly. There's still an issue with quoting older bodies as smart word-wrap can distort the text, making it tricky to see where text has been quoted. Ultimately, to *not* do this breaks the internet's Robustness Principle of "be conservative in what you send". This basically states that if you don't know what the recipient is using to receive/read mail, so don't make assumptions, and play safe. Of course, if you know what the recipient uses, you can make allowances accordingly. – Chris J Nov 29 '10 at 18:39