[Top] [All Lists]

Re: [ietf-822] Question about line folding and maximum line length

2021-05-06 09:39:40
On 06/05/2021 14:52, Bryan Frimin wrote:
1. The maximum line length.
RFC 5322 section 2.1.1[2] describes two possible line length limits. The
historical one, 78 characters, and the new one, 998 characters. Is the
historical limit still relevant for an email client in 2021, or can I
just use the new one?

998 is a MUST (to avoid possibly breaking something, although it's unlikely nowadays)

78 is a SHOULD (to make it easier for users to read).

The 78 character limit is not 'historical'; it's a recommendation, not a requirement. In fact in RFC 822, there are no line length limits defined at all, just a suggestion not to make them too long. The limits were first introduced in RFC 2822 as far as I can see, and that uses the same wording as RFC 5322

When reading RFCs it's very important to know the difference between MUST and SHOULD (in capitals) as they have a strict meaning.

So, you should try to make lines no longer than 78 characters, but if they're longer (but no longer than 998) it's not going to break anything.

2. The long line folding mechanism.
RFC 5322 section 2.2.3[3] defines a folding mechanism for long header
fields. But it does define whether it is possible to fold a header field
name longer than the limit (yes it is an edge case, but it could
happen). And folding can only be done if a lexical token or a space is
present. So what about values without any separator ?

Don't fold them if you can't. I don't think you'd fold a header field name (we don't) - as you say it's an edge-case, and I've never come across it.

It is very possible to have header lines where the data does not contain any spaces and is longer than 78 characters. That's exactly why the 78 character line-length limit is a SHOULD and not a MUST.

Obviously if you've got a header field name longer than 998 characters that you would HAVE to fold but you can't, then you've got a problem - in more ways than one.

Paul Smith Computer Services
support(_at_)pscs(_dot_)co(_dot_)uk - 01484 855800


Paul Smith Computer Services
Tel: 01484 855800
Vat No: GB 685 6987 53

Sign up for news & updates at

ietf-822 mailing list