Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Are email addresses allowed to contain non-alphanumeric characters?

I'm building a website using Django. The website could have a significant number of users from non-English speaking countries.

I just want to know if there are any technical restrictions on what types of characters an email address could contain.

Are email addresses only allowed to contain English letters, numbers, _, @ and .?

Are they allowed to contain non-English alphabets like é or ü?

Are they allowed to contain Chinese or Japanese or other Unicode characters?

like image 942
Continuation Avatar asked Oct 02 '10 04:10

Continuation


People also ask

What all characters are allowed in an email address?

uppercase and lowercase Latin letters A to Z and a to z ; digits 0 to 9 , provided that top-level domain names are not all-numeric; hyphen - , provided that it is not the first or last character.

Can email addresses contain non ASCII characters?

Although the traditional format for email header section allows non-ASCII characters to be included in the value portion of some of the header fields using MIME-encoded words (e.g. in display names or in a Subject header field), MIME-encoding must not be used to encode other information in a header, such as an email ...

Can email addresses have Unicode characters?

To use Unicode in certain email header fields, e.g. subject lines, sender and recipient names, the Unicode text has to be encoded using a MIME "Encoded-Word" with a Unicode encoding as the charset. To use Unicode in domain part of email addresses, IDNA encoding must traditionally be used.


2 Answers

Email address consists of two parts local before @ and domain that goes after.

Rules to these parts are different:

For local part you can use ASCII:

  • Latin letters A - Z a - z
  • digits 0 - 9
  • special characters !#$%&'*+-/=?^_`{|}~
  • dot ., that it is not first or last, and not in sequence
  • space and "(),:;<>@[] characters are allowed with restrictions (they are only allowed inside a quoted string, a backslash or double-quote must be preceded by a backslash)

Plus since 2012 you can use international characters above U+007F, encoded as UTF-8.

Domain part is more restricted:

  • Latin letters A - Z a - z
  • digits 0 - 9
  • hyphen -, that is not first or last, multiple hyphens in sequence are allowed.

Regex to validate

^(([^<>()\[\]\.,;:\s@\"]+(\.[^<>()\[\]\.,;:\s@\"]+)*)|(\".+\"))@(([^<>()[\]\.,;:\s@\"]+\.)+[^<>()[\]\.,;:\s@\"]{2,})

Hope this saves you some time.

like image 190
Matas Vaitkevicius Avatar answered Oct 11 '22 02:10

Matas Vaitkevicius


Well, yes. Read (at least) this article from Wikipedia.

I live in Argentina and here are allowed emails like ñoñó[email protected]

like image 38
eKek0 Avatar answered Oct 11 '22 01:10

eKek0