| Email Address | Good? | PHP | PHP Regex | Javascript | Notes |
| testing@us.example.com | Y | Y | Y |
Plain address |
| peter.piper@example.com | Y | Y | Y |
|
| _somename@example.com | Y | Y | Y |
|
| user+mailbox@example.com | Y | Y | Y |
|
| someone@3com.com | Y | Y | Y |
RFC 1123 superceded RFC RFC 1035, which would have forbade this domain |
| testing@somewhere | Y | Y | Y |
While "somewhere" is not a valid TLD yet, the email address violates no rules |
| abcdefghijklmnopqrstuvwxyz@abcdefghijklmnopqrstuvwxyz | Y | Y | Y |
|
| customer/department=shipping@example.com | Y | Y | Y |
Uncommon characters |
| !def!xyz.c%abc+@example.com | Y | Y | Y |
Uncommon characters |
| good@host-name.com | Y | Y | Y |
Hosts can have hyphens |
| 1234567890.0987654321@EXAMPLE.WHATEVER.ABC.123.CAT | Y | Y | Y |
Some check for letters in the local part |
| relay.mil%john.smith@EXAMPLE-WHATEVER.ARPA | Y | Y | Y |
Old-school relays |
| test@localhost.com | Y | Y | Y |
|
| joe@123.45.67.89 | Y | Y | Y |
IPv4 addresses are valid |
| joe@2001:0db8::1428:57ab | Y | Y | Y |
IPv6 addresses are valid |
| hello world@example.com | n | n | n |
Spaces are not allowed without quoting |
| moose@example com | n | n | n |
Domains with spaces must have brackets |
| bird@test example.com | n | n | n |
|
| Abc\\@example.com | n | n | n |
Escaping not allowed without quoting |
| Abc\@def@example.com | n | n | n |
|
| Joe.\\Blow@example.com | n | n | n |
|
| woo\ yay@example.com | n | n | n |
|
| \$A12345@example.com | n | n | n |
|
| abc@def@example.com | n | n | n |
Two @ symbols not allowed without brackets or quoting |
| one\@two@example.com | n | n | n |
Escaping doesn't make it valid either |
| Abc\\@def@example.com | n | n | n |
|
| one\.two@example.com | n | n | n |
|
| joe@123.456.7.89 | n | n | n |
This is not a valid IP address |
| mike@9472:0f6e::1bg0:9876 | n | n | n |
Invalid IPv6 address |
| mike@9472:0f6e::1b810:9876 | n | n | n |
Invalid IPv6 address |
| "woo.yay"@example.com | Y | Y | Y |
No need to quote this one, but no reason to not quote either |
| "Abc@def"@example.com | Y | Y | Y |
Properly quoted |
| "Abc\@def"@example.com | Y | Y | Y |
Properly quoted, optionally escaped |
| "Fred Frederson"@example.com | Y | Y | Y |
Spaces are allowed when quoted |
| " Test"@example.com | Y | Y | Y |
Leading spaces may be evil but allowed |
| "Fred\ Frederson"@example.com | Y | Y | Y |
Spaces are allowed and can be escaped |
| "Joe.\\Test"@example.com | Y | Y | Y |
An escaped backslash |
| "abc\\"@example.com | Y | Y | Y |
Escaped backslash at the end confuses some parsers |
| "\$A12345"@example.com | Y | Y | Y |
|
| "first".second@employs.allowable.trick | Y | Y | Y |
Uses the obsolete, yet valid form |
| "Tyler \"The Man\" A."@example.com | Y | Y | Y |
Quoted localparts can have escaped quotes |
| "Tyler\ \"The\ Man\"\ A\."@example.com | Y | Y | Y |
Escaping a lot more |
| "Quote \" Quote"@example.com | Y | Y | Y |
Some parsers have issues with the singleton quote |
| ""@the-void.example.com | Y | Y | Y |
An empty quoted localpart is valid... somehow |
| "two..dot"@example.com | Y | Y | Y |
Double periods are allowed in a quoted localpart |
| "quote@example.com | n | n | n |
Unbalanced quotes |
| quote"@example.com | n | n | n |
|
| quote\"@example.com | n | n | n |
Escaping doesn't make it valid either |
| "Tyler "The Man" A."@example.com | n | n | n |
Quotes in the middle must be escaped |
| Tyler\ \"The Man\"\ Akins@example.com | n | n | n |
Escaping characters requires the localpart to be quoted |
| Tyler\ \"The Man\"\ A\.@example.com | n | n | n |
|
| "first."second@bad-quoting.info | n | n | n |
If the quote and the period were swapped, this would be valid. |
| testingAVeryLongEmailAddressAgainstTheParser.ThisOneShouldBeGood@e.ca | Y | Y | Y |
64 characters in the localpart |
| testingAVeryLongEmailAddressAgainstTheParser.ThisOneIsABadAddress@e.ca | n | n | n |
The localpart is one character too long |
| x@superduperlonglinethatisexactlysixtythreecharactersjustfortests.com | Y | Y | Y |
63 letters is the maximum length of a label in the domain |
| x@superduperlonglinewaymorethansixtythreecharactersforsureblahblah.com | n | n | n |
Domain label is one character too long |
| @example.com | n | n | n |
No localpart |
| doug@ | n | n | n |
No domain |
| .dot@example.com | n | n | n |
Localpart can not start with a period |
| dot.@example.com | n | n | n |
Localpart can not end with a period |
| two..dot@example.com | n | n | n |
Localpart can not have two successive periods |
| matt@.example.com | n | n | n |
Domain starts with a period |
| matt@example.com. | n | n | n |
Domain ends with a period |
| timothy@test-host..tld | n | n | n |
Domain contains double period |
| user@??? | n | n | n |
Top level domain must be all alphabetic |
| user@domain.c0m | n | n | n |
|
| user@-example.com | n | n | n |
Domain has leading hyphen on a label |
| user@example-.com | n | n | n |
Domain has trailing hyphen on a label |
| user@test.-example.com | n | n | n |
Domain has a leading hyphen on a label |
| user@test--example.com | n | n | n |
Domain has two successive hyphens |
| test@[example.com] | Y | Y | Y |
Bracketed domain |
| example@[hello world.com] | Y | Y | Y |
Bracketed domains can contain spaces |
| example@[hello\ world.com] | Y | Y | Y |
Bracketed domains can have escaped characters |
| matt@[test--valid.tld] | n | n | n |
Bracketed domains still can't violate the period nor hyphen rules. |
| matt@[-host.tld] | n | n | n |
|
| matt@[host-.tld] | n | n | n |
|
| matt@[example..com] | n | n | n |
|
| matt@[.example.com] | n | n | n |
|
| matt@[example.com.] | n | n | n |
|
| matt@[numeric.tld.l33t] | n | n | n |
|
| test@[hello@world.com] | Y | Y | Y |
Yes, domains can have an @ symbol |
| cat@[example].com | n | n | n |
Invalid bracketing |
| mouse@[test example].com | n | n | n |
|
| dog@[example.com | n | n | n |
|
| ant@[test\ example].com | n | n | n |
|