Filter internet based email addresses

Go To StackoverFlow.com

0

How can I go about doing a client side validation for email addresses where the email address has to be a non-internet based one as much as possible. i.e yahoo, gmail and hundreds are not allowed. It doesn't have to be perfect but I just want to minimize all the obivious scenarios of such email addresses being valid.

Currently I just use a regex to check for valid (well...almost valid) email addresses.

Any Ideas?

2009-06-16 10:29
by Uchitha
and what's wrong with regex validation - Artem Barger 2009-06-16 10:33
What does "a non-internet based one" mean, anyway - grawity 2009-06-16 11:01
What I meant by a "a non-internet based" email is just a co-orporate email. Just to make sure that the email belongs to a person from a (proper) organization and not a general surfer - Uchitha 2009-06-19 06:20


0

What I am reading as a non-webmail-account requirement is of questionable utility at this point, and nearly impossible to actually guarantee. If it's truly part of your hard requirements, it means that people who have migrated to gmail-as-primary-email will need to register a secondary account, and that would, for me, increase my odds of deciding your site wasn't worth registering ON.

That said, a regex that properly validates RFC2822 addresses, plus an exclusion list, is going to be ugly as sin (because the RFC2822 validating regex is also ugly as sin).

Finally, remember the fact that you will also need to validate this submission on the server side, because you can't trust that the validation on the client actually ran.

2009-06-16 11:33
by Tetsujin no Oni


2

Assuming that by "non-internet" you mean "local", then the solution should be fairly simple: Whitelist hostnames that are allowed to host mail addresses you accept.

A slightly more complex solution, which might need a little less maintainence (depending on your systems), would be to blacklist all hostnames ending in a country or global top level domain, and then have an exception list for your own domains.

2009-06-16 10:40
by Quentin
Ads