forms - What characters are allowed in an email address? -


i'm not asking full email validation.

i want know allowed characters in user-name , server parts of email address. may oversimplified, maybe email adresses can take other forms, don't care. i'm asking simple form: user-name@server (e.g. wild.wezyr@best-server-ever.com) , allowed characters in both parts.

see rfc 5322: internet message format and, lesser extent, rfc 5321: simple mail transfer protocol.

rfc 822 covers email addresses, deals structure:

 addr-spec   =  local-part "@" domain        ; global address       local-part  =  word *("." word)             ; uninterpreted                                              ; case-preserved   domain      =  sub-domain *("." sub-domain)       sub-domain  =  domain-ref / domain-literal       domain-ref  =  atom                         ; symbolic reference 

and usual, wikipedia has decent article on email addresses:

the local-part of email address may use of these ascii characters:

  • uppercase , lowercase latin letters a z , a z;
  • digits 0 9;
  • special characters !#$%&'*+-/=?^_`{|}~;
  • dot ., provided not first or last character unless quoted, , provided not appear consecutively unless quoted (e.g. john..doe@example.com not allowed "john..doe"@example.com allowed);
  • space , "(),:;<>@[\] characters allowed restrictions (they allowed inside quoted string, described in paragraph below, , in addition, backslash or double-quote must preceded backslash);
  • comments allowed parentheses @ either end of local-part; e.g. john.smith(comment)@example.com , (comment)john.smith@example.com both equivalent john.smith@example.com.

in addition ascii characters, as of 2012 can use international characters above u+007f, encoded as utf-8.

for validation, see using regular expression validate email address.

the domain part defined as follows:

the internet standards (request comments) protocols mandate component hostname labels may contain ascii letters a through z (in case-insensitive manner), digits 0 through 9, , hyphen (-). original specification of hostnames in rfc 952, mandated labels not start digit or hyphen, , must not end hyphen. however, subsequent specification (rfc 1123) permitted hostname labels start digits. no other symbols, punctuation characters, or blank spaces permitted.


Comments

Popular posts from this blog

unicode - Are email addresses allowed to contain non-alphanumeric characters? -

C#: Application without a window or taskbar item (background app) that can still use Console.WriteLine() -

c++ - Convert big endian to little endian when reading from a binary file -