Valid E-Mail addresses aren't recognized
gingters opened this issue · comments
At least the following two valid E-Mail adresses are not recognized correctly:
üñîçøðé@example.com (Unicode characters in the local part)
"very.(),:;<>[]".VERY."very@\ "very".unusual"@strange.example.com (correct escaping of quotes in the local part)
Please see for reference and additional test cases the list of valid E-Mail addresses at http://en.wikipedia.org/wiki/Email_address
I don't think unicode in the local-part is actually valid. The RFCs refer to atext (atom-text) which is ASCII-only.
I'm pretty sure people just got confused when they got the idea that it's letters or digits and assumed unicode.
"very.(),:;<>[]".VERY."very@\"very".unusual"@strange.example.com is not actually valid, I can only assume it is a typo on the part of Wikipedia.
Notice the \" - the first \ escapes the second , but does not escape the ", therefor terminating the qstring token. Each token must be separated by a . or it is invalid.
This is the actual example from wikipedia:
"very.(),:;<>[]".VERY."very@\ "very".unusual"@strange.example.com
That extra \ makes allll the difference in the world ;-)
That one actually passes in my unit tests (I just added it along with the other wikipedia test cases)
The only one that doesn't pass is the unicode example, but that's trivial to fix (just use char.IsLetterOrDigit() instead of my custom IsLetterOrDigit() method).
The support for unicode seems to come from rfc6531 (obsoletes rfc5336) which extends rfc5321 (which is what I used to implement EmailValidation) by adding the SMTPUTF8 extension flag to SMTP.
Realistically, it's not a widely adopted specification afaict so validating those addresses seems to me to be of somewhat limited value.
According to wikipedia, sendmail and postfix are the only servers working on adding support for this extension but so far have not. http://en.wikipedia.org/wiki/Extended_SMTP#List_of_supporting_servers_3
FWIW, it seems that double-\ gets mangled by github's comment code, so what you pasted may have been correct originally.
In any event, that example from wikipedia works fine.