Verify top-level domain email address

Our QA filed an error stating that the top level domain of an email address cannot contain a single character.

foo@bar.z 

It's hard for me to look at the standards. Can someone confirm that the minimum length of the top-level domain is set correctly?

+4
source share
3 answers

Rules for checking email addresses are complex because they may be erroneous in their implementation.

Instead of checking the email address, try checking it directly: 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 can enter single-letter top-level domain names, and individual DNS labels can have a length of 1, in fact "bar.z" is a valid email domain name if sent from the DNS tree / organization where it exists as a subdomain (i.e. if the mail server is smtp.mycompany.org , and I also defined the MX server for bar.z.mycompany.org ).

+2
source

Note that for this purpose I wrote a small library call to C libtld . This may be useful for you. Please note that the amount of data needed to support all TLDs around the world is quite staggering, so I will not implement them in Javascript. This may be if you can compress the data more ... The library also includes a PHP extension, so you can use functions and results directly from PHP.

+1
source

Until now, the length of the top-level domain of the email should be located in [2.6], but this is not a constant line, because everything changes. Checking your email is very difficult, you can’t know if the email address can actually receive email until you try to send it an email, although it follows the email standard.

0
source

All Articles