It requires that the domain part of each address be a sequence of elements separated by dots, where each element is either a component, a sequence of digits preceded by #, or a dotted-decimal IP address surrounded by brackets. The only allowable characters in components are letters, digits, and dashes; Klensin specifically requires that underscores be rejected. Every component must have at least one character.
In practice, servers have to be prepared to handle domains ending with dots, and components containing underscores.
RFC 821 also requires that each component have at least three bytes; that the first byte be a letter; and that the last byte be a letter or digit. However, these restrictions are completely out of whack with reality. As far as I know, no server enforces them.
RFC 821 prohibits non-ASCII characters, empty box parts, box parts longer than 64 bytes, and domain parts longer than 64 bytes. These requirements are occasionally disobeyed in practice.
RFC 821 requires that servers be able to handle box parts as long as 64 bytes and domain parts as long as 64 bytes.
The characters \0 and \012 are unsafe in practice. Klensin prohibits all ASCII control characters.
@heaven.af.mil,@uucp.localis a route.
Routes were heavily discouraged in RFC 1123. Their function is actively subverted by most Internet mailers. Clients should not generate them. However, they still show up occasionally; servers have to be able to parse the route syntax.
For example, the encoded box parts
angels \a\n\g\e\l\s "\a\n\g\e\l\s" "angels" "ang\els"all represent the 6-byte string "angels", and the encoded box parts
a\,comma \a\,\c\o\m\m\a "a,comma"all represent the 7-byte string "a,comma".
Copy the string without quoting if
For example, the encoded addresses
<God@heaven.af.mil> <\God@heaven.af.mil> <"God"@heaven.af.mil> <@gateway.af.mil,@uucp.local:"\G\o\d"@heaven.af.mil>all represent the Internet mail address "God@heaven.af.mil". Beware, however, that sendmail interprets these as different addresses.
Keep track of whether you are inside quotes or outside quotes; initially you are outside quotes. Skip the starting <. If the next character is @, skip all characters through the next colon. Now perform the following procedure:
Beware that some clients (e.g., Neologic SMTPD, Worldgroup SMTP) incorrectly include one or more spaces before each encoded address:
RCPT TO: <firstname.lastname@example.org> (WRONG)Some clients (e.g., Windows CE) fail to enclose addresses in brackets:
RCPT TO: email@example.com (WRONG)In some cases a client will omit the domain: