The semantics of a tokenizable field value depend only on its tokens. A writer can freely insert comments, spaces, and tabs between tokens. For example, some writers will insert spaces inside long addresses:
To: cryptographic-cookie-940d3af4f1357d203c7afd5162e9d06e
@heaven.af.mil
Readers should identify tokens as discussed below,
and ignore spaces and comments during parsing.
Unfortunately, many readers use ad-hoc parsers that do not extract tokens correctly. It is a bad idea to put spaces, tabs, or comments at unusual locations. 822bis has a huge number of new rules prohibiting or discouraging various spaces, tabs, and comments.
heaven
is an atom representing the 6-byte string "heaven".
A string containing an unusual character, such as space or semicolon,
cannot be encoded as an atom.
(822 prohibits all control characters, byte 127 and bytes 0 through 31,
in atoms, as well as ], backslash, and right parenthesis.)
A quoted string is a double quote, zero or more quoted string chunks, and another double quote. A quoted string chunk represents a single character; it can be
"heaven"
and
"h\e\ave\n"
are two quoted strings,
each representing the 6-byte string "heaven";
and
"\\\\\\"
is a quoted string representing three backslashes.
Any string can be encoded as a quoted string.
A domain literal is a left bracket, zero or more domain literal chunks, and a right bracket. A domain literal chunk represents a single character; it can be
[127.0.0.1]
and
[\1\2\7\.\0\.\0\.\1]
are two domain literals,
each representing the 11-byte string "[127.0.0.1]".
Any string starting with [ and ending with ]
can be encoded as a domain literal.
Several clients (reportedly: AMS and various IMAP servers) cannot handle domain literals containing colons:
[FF02::3492:A98F]
(D. J. Bernstein)
(comment (nested (deeply)) (and (oh no!) again))
(\)\\)
(by way of Whatever <redir@my.org>) (generated by Eudora)
":sysmail"@ group. org, Muhammed.(the greatest) Ali @(the)Vegas.WBA
contains
God@heaven. af.mil
correctly; it truncates the address after the first dot.