Our QA has filed a bug that says top level domain of the email address cannot be of one character.
[email protected]
I am having a hard time looking into standards. Can somebody confirm if setting top level domain minimum length is a right thing to do?
The rules for validating email addresses are as complicated as they are likely to be buggy in their implementation.
Rather than validating an email address, consider verifying it directly instead: http://davidcel.is/blog/2012/09/06/stop-validating-email-addresses-with-regex/
The problem with your case, is that there is a very real possibility that ICANN might introduce single-letter top-level domain names, and individual DNS labels can be of length 1, in fact "bar.z" is a valid email address domain name if sent from within a DNS tree/organization where that exists as a sub-domain (i.e. if the mailserver is smtp.mycompany.org
and I've also defined an MX server for bar.z.mycompany.org
).
Note that I wrote a small C library call libtld for that purpose. It may be useful to you. Note that the amount of data required to support all TLDs, world wide, is quite staggering so I would not implement such in Javascript. That being said, maybe if you can compress the data more... The library also includes a PHP extension so you can use the functions and results directly from PHP.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With