Greg Cohoon (drmellow) wrote,
Greg Cohoon

Email Address Validation

Email address validation always seems to be difficult. In reality, it's not difficult, it's just tedious. I tend to find a lot of broken email validators because my email address is a bit less than common.

Today, I was using the "Contact Us" Form at my credit union and ran into a validation error on my email address. I had a little time, so I decided to look for the javascript that was causing the problem. I found it, and it was pretty easy to spot, so I decided to send the credit union another message:

My email address ( is reported as invalid by this form. Please submit a bug report to your developers and have them correct the logic in the "isEmail" javascript function on the page. Currently, assumption #4 is incorrect, as not all TLDs are simply 2 or 3 characters. To get around the ".name" issue, the following code can be used for the last portion of "reg2":


However, fixing the code in that manner would still cause it to consider addresses ending in ".info", e.g. to be invalid. A better solution would be to determine the actual rules governing the naming of TLDs and implement a correct validation algorithm.

It looks like you have the same bug in the "isURL" function.

I'm interested in seeing what sort of customer service response a "contact us" message like this will generate.

Ironically, I am currently wearing my "No, I will not fix your computer." shirt.


  • Post a new comment


    Anonymous comments are disabled in this journal

    default userpic

    Your reply will be screened

    Your IP address will be recorded