Quick links: Source code | Email address validation service
Do you think this is a valid email address?
""@example.com
No, me neither. In one sense it clearly isn’t since there is no mailbox of that name at example.com’s mail host. Send mail to that address and you won’t find anybody reading it.
In another sense, however, it is a perfectly good email address. That is, if you believe the RFCs that define how email addresses should be constructed. Here’s the BNF from RFC5322 for example:
addr-spec = local-part "@" domain
local-part = dot-atom / quoted-string / obs-local-part
quoted-string = [CFWS] DQUOTE *([FWS] qcontent) [FWS] DQUOTE [CFWS]
Don’t worry if you can’t follow the BNF syntax - I couldn’t either until this week. Focus on the asterisk before ([FWS] qcontent). That asterisk means the contents of that bracket can occur zero or more times.
So tracing it through the specification:
- An email address is a local-part followed by an @ sign followed by a domain
- A local-part can be a quoted-string
- A quoted-string is a pair of double quotes surrounding zero or more characters.
”“@example.com follows these rules perfectly. And yet common sense suggests this is a preposterous address. Where should the receiving host deliver it?
I have had some discussions about this with Cal Henderson and we are somewhat at a loss. Both of us have functions that validate email addresses and we cannot decide whether to follow the RFCs or common sense.
I could suggest the IETF add an erratum to their RFC but this format is also documented in RFC 5321 as well. No amount of published errata will correct the impression given by two published RFCs.
Perhaps we are wrong - can you think of a valid purpose for an email address of this format?