Reputation: 3
I have a multiple emails seperated by commas. How to validate all these emails field using javascript.
Upvotes: 0
Views: 698
Reputation: 92752
What to validate in an e-mail address is a bit of a contentious topic (for example [email protected]
is actually a valid e-mail address, but most naïve validators reject it) - checking for a part before the @
, and a probably-valid domain name after the @
(anything separated by a dot, due to the complex mess that is TLDs these days) should be sufficient.
(why not validate the domain: you'll get it wrong. That's nothing personal, everyone gets it wrong: you, me, everyone - what with internationalized domain names, domain names longer than 4 characters, alternate DNS roots, internal domains, new domains approved each year, etc etc. If the mail bounces, too bad - but trying to validate the domain in JS is rather futile.)
Upvotes: 1