identifier of the destination where email messages are delivered
Email Address Format
forms - What characters are allowed in an email address? - Stack Overflow
What formula for email addresses do you use, and why?
What is deemed as a professional email address? Do you recommend creating a domain or is using "@gmail.com" okay?
Videos
John Doe <[email protected]> → what do you call the whole thing?
It's called a mailbox, as specified in RFC 5322 on page 45:
3.4. Address Specification
Addresses occur in several message header fields to indicate senders and recipients of messages. An address may either be an individual mailbox, or a group of mailboxes.
Normally, a mailbox is composed of two parts: (1) an optional display name that indicates the name of the recipient (which can be a person or a system) that could be displayed to the user of a mail application, and (2) an addr-spec address enclosed in angle brackets ("<" and ">"). There is an alternate simple form of a mailbox where the addr-spec address appears alone, without the recipient's name or the angle brackets. The Internet addr-spec address is described in section 3.4.1.
Source 3.4. Address Specification
See also Appendix A.1.2. Different Types of Mailboxes
It is in the RFC5322, you just missed it:
address = mailbox / group
mailbox = name-addr / addr-spec
name-addr = [display-name] angle-addr
angle-addr = [CFWS] "<" addr-spec ">" [CFWS] / obs-angle-addr
group = display-name ":" [group-list] ";" [CFWS]
display-name = phrase
mailbox-list = (mailbox *("," mailbox)) / obs-mbox-list
address-list = (address *("," address)) / obs-addr-list
group-list = mailbox-list / CFWS / obs-group-list
Let's break this down.
address either a mailbox or a group. A mailbox is a name-addr or addr-spec.
This name-addr is the format you're asking about: there is an optional display-name (it's optional because it is defined with square brackets) followed by the angle-addr, which itself is an addr-spec in angle brackets with optional foldable space CFWS on both sides of it (defined further in the section 3.2.2), or an obsolete address format obs-angle-addr.
A whole section 3.4.1 is dedicated to the description of addr-spec format.
So, in conclusion:
John Doe <[email protected]>is aname-addr, which is a variant ofmailbox, which is a variant ofaddress.John Doeis adisplay-name<[email protected]>is anangle-addr[email protected]is anaddr-specjohnis alocal-partexample.comis adomain.
I am switching over the company I work for to a new email system. We are switching from a local company that we have used for over 20 years to Google’s Gmail.
We planned on changing the email address formats from a firstname and first initial of last name format ([email protected]) to a [email protected] … that is until the CEO decided that we needed to discuss it more.
His concerns were privacy, and that the shorter the better because when handing it out, it’s very hard to hand out emails already let alone bigger ones rather than shorter. I understand his views about it, but wanted to see what you all thought about this.
We are going to meet again in 3 days and discuss what way we should go. What are your thoughts on this? What format do you prefer and why? Also if you had a choice of the two I presented what would you prefer and why?
See RFC 5322: Internet Message Format and, to a lesser extent, RFC 5321: Simple Mail Transfer Protocol.
RFC 822 also covers email addresses, but it deals mostly with its 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
where an atom and word are defined as
; ( Octal, Decimal.)
CHAR = <any ASCII character> ; ( 0-177, 0.-127.)
CTL = <any ASCII control ; ( 0- 37, 0.- 31.)
character and DEL> ; ( 177, 127.)
specials = "(" / ")" / "<" / ">" / "@" ; Must be in quoted-
/ "," / ";" / ":" / "\" / <"> ; string, to use
/ "." / "[" / "]" ; within a word.
atom = 1*<any CHAR except specials, SPACE and CTLs>
word = atom / quoted-string
And as usual, Wikipedia has a decent article on email addresses:
The local-part of the email address may use any of these ASCII characters:
- uppercase and lowercase Latin letters
AtoZandatoz;- digits
0to9;- 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.comis 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.comand(comment)[email protected]are both equivalent to[email protected].
In addition to ASCII characters, as of 2012 you can use international characters above U+007F, encoded as UTF-8 as described in the RFC 6532 spec and explained on Wikipedia. Note that as of 2019, these standards are still marked as Proposed, but are being rolled out slowly. The changes in this spec essentially added international characters as valid alphanumeric characters (atext) without affecting the rules on allowed & restricted special characters like !# and @:.
For validation, see Using a regular expression to validate an email address.
The domain part is defined as follows:
The Internet standards (Request for Comments) for protocols mandate that component hostname labels may contain only the ASCII letters
athroughz(in a case-insensitive manner), the digits0through9, 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.
Watch out! There is a bunch of knowledge rot in this thread (stuff that used to be true and now isn't).
To avoid false-positive rejections of actual email addresses in the current and future world, and from anywhere in the world, you need to know at least the high-level concept of RFC 3490, "Internationalizing Domain Names in Applications (IDNA)". I know folks in US and A often aren't up on this, but it's already in widespread and rapidly increasing use around the world (mainly the non-English dominated parts).
The gist is that you can now use addresses like mason@日本.com and wildwezyr@fahrvergnügen.net. No, this isn't yet compatible with everything out there (as many have lamented above, even simple qmail-style +ident addresses are often wrongly rejected). But there is an RFC, there's a spec, it's now backed by the IETF and ICANN, and--more importantly--there's a large and growing number of implementations supporting this improvement that are currently in service.
I didn't know much about this development myself until I moved back to Japan and started seeing email addresses like hei@やる.ca and Amazon URLs like this:
http://www.amazon.co.jp/エレクトロニクス-デジタルカメラ-ポータブルオーディオ/b/ref=topnav_storetab_e?ie=UTF8&node=3210981
I know you don't want links to specs, but if you rely solely on the outdated knowledge of hackers on Internet forums, your email validator will end up rejecting email addresses that non-English-speaking users increasingly expect to work. For those users, such validation will be just as annoying as the commonplace brain-dead form that we all hate, the one that can't handle a + or a three-part domain name or whatever.
So I'm not saying it's not a hassle, but the full list of characters "allowed under some/any/none conditions" is (nearly) all characters in all languages. If you want to "accept all valid email addresses (and many invalid too)" then you have to take IDN into account, which basically makes a character-based approach useless (sorry), unless you first convert the internationalized email addresses (dead since September 2015, used to be like this—a working alternative is here) to Punycode.
After doing that you can follow (most of) the advice above.