Have you ever thought about what characters are allowed in an email address or what are the rules for an email address syntax? In the world of computer and programming languages, it is well known that and extra white space or dot could break a program or action. In the world of emails, there are exactly the same rules. A correct email address needs to have some standard parts. If every part does not follow its rules, a syntax error will show up. To make it more clearly, I want to provide a valid email address: [email protected]. This address has no syntax error. If I add an extra dot, then it becomes a syntax error: [email protected].
Each email address has three main parts. Here they are:
- Recipient Name or Local Part
- @ Symbol
- Domain Part
I am going to describe each part of and standard email address.
Local Part
The local part or the recipient name is what exactly comes before the @ symbol. It could be name of the account holder, a role in a company like manager, or a department. There are specific and define characters that can be used in local part:
- Lowercase and uppercase Latin letters A-Z and a-z
- Digits from 0 to 9
- Dot ., provided that it is not the first or last character unless quoted, and provided also that it does not appear consecutively unless quoted. For example, [email protected] is not allowed but "mark..russell"@example.com is allowed
- Space and "(),:;<>@[\] characters are allowed with restrictions. They are only allowed inside a quoted string, 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. For example mark.russell(comment)@server.com and (comment)[email protected] are both equivalent to [email protected].
Despite all above mentioned characters are logically valid, some email providers may restricted the use of some characters. Moreover, email addresses could be sensitive against upper and lowercase. However, most of email servers are configured to consider all the cases as the same inbox. It is worth mentioning that the local part cannot exceed 64 characters.
@ Symbol
I think this is easy to guess. There must be only one @ after the local part which separates the local-part and the domain-part.
Domain Part
A domain name consists of one or more sections, technically referred to as labels, typically interconnected and separated by dots. For instance example.com.
Domain Name (Second-Level Domain)
A domain name is a series of letters and digits describing a space owned and operated by a single mailbox provider or entity on the Internet. These characters are allowed for the domain name part:
- Lowercase and uppercase Latin letters A-Z and a-z
- Digits from 0 to 9
- Hyphen: -
- IP address surrounded by square brackets: mark.russell@[192.168.2.1] or mark.russell@[IPv6:2001:db8::1]
- Dot ., In case a subdomain is used. Example: [email protected]
TLD or Top-Level Domain
The top-level domain is expressed by the right-most label; for example, the domain name www.debounce.io is part of the top-level domain io.
Here are the five most common domain extensions to consider in 2020.
- .com
- .net
- .org
- .co
- .us
It is worth mentioning that the domain part (domain name + TLD) cannot exceed 255 characters.
Examples
Here are some examples of valid and invalid email syntaxes for better understanding.
Email Address |
Valid Syntax? |
Reason |
Yes |
- |
|
xyz.example.com |
No |
No @ character. |
No |
Only one @ is allowed outside quotation |
|
#!$%&'*+-/=?^_`{}|[email protected] |
Yes |
Strange, But this is valid 😉 |
No |
Double dot before @ not allowed. |