Email Rfc

Ever read rfc’s? no? me neither…

What I found out was surprising. Nearly 100% of regular expressions on the web purporting to validate an email address are too strict.

It turns out that the local part of an email address, the part before the @ sign, allows a lot more characters than you’d expect. According to section 2.3.10 of RFC 2821 which defines SMTP, the part before the @ sign is called the local part (the part after being the host domain) and it is only intended to be interpreted by the receiving host…

These are all valid email addresses!

Abc\@[email protected]
Fred\ [email protected]
Joe.\\[email protected]
"[email protected]"
"Fred Bloggs"
customer/[email protected]
[email protected]
!def!xyz%[email protected]
[email protected]

so, for the regex fans that want to support this, use this

I think I’ll sign up for an email address like luc.w\@[email protected] and start bitching at sites that require emails but don’t let me create an account with this new email address. Ooooooh I’m such a troublemaker.

edit: Watch out with plusses in your email adress, it is [email protected] and not the other way around. This already costed me 20$

Tags: ,