Folding long fields
02One logical header field can span physical lines at permitted folding white space.
DIAGRAMRead RFC section 2.2.3 ↗
RFC 5322 · § 2.2.3EXAMPLE
3 / 3
03
Unfold on receipt.
Remove the folding CRLF before interpreting the logical field.
Key idea: Unfold before interpreting a field.
Rules & examples
Unfold before interpreting a field.
- Lines must not exceed 998 characters; 78 is the recommended limit, excluding CRLF.
- Unfolding removes CRLF immediately followed by white space.
A display wrap is not necessarily a legal wire-format fold. Reject header injection.
Sources
Protocol participantThreat or exceptionProtocol controlSimplified drawings · precise section references
New to this? Start hereA quick picture + helpful background
The envelope and the letter do different jobs.
Mail transport moves a message between servers. The message format describes its contents. Authentication adds checks; it does not make every message safe.
Helpful first, if these ideas are unfamiliar
These pictures are analogies to help you learn. The linked RFC explains the actual rules.
Related RFCs and changes
“Updates” changes part of an earlier RFC. “Obsoletes” replaces it. This list shows selected related documents.
Read the updated RFC section ↗