Skip to main content

Appendix B. Simple Parsing

Some mail-reading software systems may wish to perform only minimal processing, ignoring the internal syntax of structured field-bodies and treating them the same as unstructured-field-bodies. Such software will need only to distinguish:

  • Header fields from the message body,
  • Beginnings of fields from lines which continue fields,
  • Field-names from field-contents.

The abbreviated set of syntactic rules which follows will suffice for this purpose. They describe a limited view of messages and are a subset of the syntactic rules provided in the main part of this specification. One small exception is that the contents of field-bodies consist only of text:

SYNTAX:

message         =  *field *(CRLF *text)

field = field-name ":" [field-body] CRLF

field-name = fnatom *( LWSP-char [fnatom] )

fnatom = 1*<any CHAR, excluding CTLs, SPACE, and ":">

field-body = *text [CRLF LWSP-char field-body]

SEMANTICS:

Headers occur before the message body and are terminated by a null line (i.e., two contiguous CRLFs).

A line which continues a header field begins with a SPACE or HTAB character, while a line beginning a field starts with a printable character which is not a colon.

A field-name consists of one or more printable characters (excluding colon), each separated by one or more SPACES or HTABS. A field-name MUST be contained on one line. Upper and lower case are not distinguished when comparing field-names.