Click to See Complete Forum and Search --> : Email address validator is WRONG


smjg
05-02-2008, 10:52 AM
The email validator at
http://javascript.internet.com/forms/check-email.html
rejects many perfectly valid email addresses with the message
"The address must end in a three-letter domain, or two-letter country."

This is complete nonsense. There has never been any restriction that top-level domains must be either two or three letters long, and there are already several legitimate TLDs that are longer than this.

Please fix or remove your script before even more people use it to inadvertently discriminate against anybody with an email address in such a TLD.

LeeU
05-02-2008, 03:51 PM
This is complete nonsense. There has never been any restriction that top-level domains must be either two or three letters long, and there are already several legitimate TLDs that are longer than this.
Well, first, yes, there used to be a restriction. You can't just make up TLDs. They are set by ICANN. And yes, there are a few now. I'll look at the script.

Aside from that one part, was there something else? Please be a bit specific. Do you have code suggestions?

BTW, there are other validation scripts there.

smjg
05-02-2008, 04:33 PM
Thank you for the acknowledgement. What I meant about there never being such a restriction is that it wasn't part of the syntax of a domain name, merely the fact that no longer TLDs had yet been invented (apart from the infrastructure TLDs .arpa and .root) until more recent years.

Nowadays, the longest existent TLDs (not counting 'reserved' TLDs that you won't find in any real email addresses) seem to be 6 letters. You can probably get away with setting the range to 2 to 6

if (domArr[domArr.length-1].length<2 ||
domArr[domArr.length-1].length>6) ...
but should watch out for the possibility that ICANN comes up with some longer ones in the future.

I don't have any particular other points to make at the moment. But I will check out the other validators in due course.