21 comments

[ 3.2 ms ] story [ 43.7 ms ] thread
Interesting that Guatemala is using GMail. And Trinidad is using RoadRunner? hahaha
Not that I pay that much attention to TLDs but I never knew the Vatican City got its own.
a@b is also a valid email address.

It is also a valid SMTP address, assuming you have defined "b" as a FQDN in your DNS.

What we have here is a list of TLDs which have MX records, but an MX record is not even required to send mail to a FQDN. An A record will suffice, for any RFC compliant SMTP server.

A TLD does not need an MX record to receive mail. If the MX record does not exist, it will use the A record instead.
Do you know of a TLD with an A-record ?
Yes, the very first one on this list, .ac

http://en.wikipedia.org/wiki/List_of_Internet_top-level_doma...

  # dig ac.
  
  ; <<>> DiG 9.3.6-P1-RedHat-9.3.6-16.P1.el5_7.1 <<>> ac.
  ;; global options:  printcmd
  ;; Got answer:
  ;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 37041
  ;; flags: qr rd ra; QUERY: 1, ANSWER: 1, AUTHORITY: 0, ADDITIONAL: 0
  
  ;; QUESTION SECTION:
  ;ac.                            IN      A
  
  ;; ANSWER SECTION:
  ac.                     86400   IN      A       193.223.78.210
  
  ;; Query time: 173 msec
  ;; SERVER: 10.0.80.11#53(10.0.80.11)
  ;; WHEN: Thu Dec  8 11:37:09 2011
  ;; MSG SIZE  rcvd: 36
I'm not going to go down the list and try the rest.
This works for Martinique. Cool. I'll try and ask the same @mq :-)
Not on my servers. This regexp is time-honored and catches more silly mistakes than it rejects valid ones.

  function isValidEmail(email) {
    return (/^[-a-z0-9\~\!\$\%\^\&\*_\=\+\}\{\'\?]+(\.[-a-z0-9\~\!\$\%\^\&\*_\=\+\}\{\'\?]+)*@([a-z0-9_][-a-z0-9_]*(\.[-a-z0-9_]+)*\.(aero|arpa|biz|com|coop|edu|gov|info|int|mil|museum|name|net|org|pro|travel|mobi|xxx|[a-z][a-z])|([0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}))$/i.test(email));
  }
>Not on my servers.

Sorry but "your servers" do not set the specifications for what is and what is not a valid email address. It always amazes me why people waste time with regular expressions to try and determine if an email address is valid or not before sending an email.

The best and by far easiest way to determine if an email address is valid is to just send an email to it. Your regular expression matches invalid email addresses (like anything@____.com) and misses things like "This is valid"@example.com.

> It always amazes me why people waste time with regular expressions to try and determine if an email address is valid or not before sending an email

Some of us want to check if a newly entered email address appears valid while we still have the user on our site, so if there is an obvious problem we can get it fixed.

How do you address that with the "just send an email" approach? If the mail bounces, how do I contact the user to tell them to come back to the site and try again?

The point of validation is to help users signing up for web sites. A fair percentage enter their email wrong, like

bill.smith@gmail dave@aol bob

You can only help them if you give them feedback immediately. If you let them register with a broken email address, they're hosed.

The problem with your script, though is that you have to manually update it, like you did with aero, museum, xxx, etc. A much better, albeit slightly more expensive solution, is to get the domain and see if it actually exists and has an mx record, because as this shows, there are times when that regex falls apart.
Correct approach: display a warning that says something like "We think you've mistyped your email address. Please re-enter it, otherwise click 'submit' if you think we're wrong :)"

I'm tired of sites not accepting perfectly valid symbols like "+" in my email address.

Last week I got into a discussion with a client over email validation rules; they wanted "contains an '@' and a '.'". Even after explaining that the '.' was optional they insisted n these rules.

Which made be wonder just how many problems will be seen once companies can use vanity top level domains; if I buy the "doug" TLD how long before I give up on lost email and switch from me@doug back to me@doug.com?

I used to have r@ai. (Anguilla; my neighbor, Vince Cate, was the registrar, and we had a 10base2 coax feed to the national root server (and his ISP).)

Ian Goldberg had n@ai, which was even better.