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));
}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.
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?
I'm tired of sites not accepting perfectly valid symbols like "+" in my email address.
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.
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.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.
Ian Goldberg had n@ai, which was even better.
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?