allowed characters in email code example

Example 1: what characters are allowed in an email address

uppercase and lowercase Latin letters A to Z and a to z;

digits 0 to 9;

special characters !#$%&'*+-/=?^_`{|}~;

dot ., provided that it is not the first or last character unless quoted, 
and provided also that it does not appear consecutively unless quoted 
(e.g. [email protected] is not allowed but "John..Doe"@example.com is allowed);

space and "(),:;<>@[\] characters are allowed with restrictions (they are only allowed 
inside a quoted string, as described in the paragraph below, and in addition, a backslash 
or double-quote must be preceded by a backslash);

comments are allowed with parentheses at either end of the local-part; e.g. 
john.smith(comment)@example.com and (comment)[email protected] are both equivalent 
to [email protected].

Example 2: what characters are allowed in an email address

Domain:

The Internet standards (Request for Comments) for protocols mandate that component hostname 
labels may contain only the ASCII letters a through z (in a case-insensitive manner), the 
digits 0 through 9, and the hyphen (-). The original specification of hostnames in RFC 952, 
mandated that labels could not start with a digit or with a hyphen, and must not end with a 
hyphen. However, a subsequent specification (RFC 1123) permitted hostname labels to start with 
digits. No other symbols, punctuation characters, or blank spaces are permitted.

Tags:

Misc Example