views:

63

answers:

3

i want to avoid public email / free emails like (@gmail.com,@yahoo.com.,) in site registration ..

+4  A: 

So just parse the email address and compare the domain to your blacklist...

Visage
Perfect answer for all given information.
Tom Gullen
I would use a whitelist though... The number of public email domains out there is pretty large...
Buggabill
+2  A: 

You cannot determine what the user is paying based on the email address. All you can hope for this way is to blacklist a few of the more popular domains - but then, there is an infinity of others left. I know hardly anyone paying money for (just) their email address, so the question IMHO is rather what kind of user you want to avoid.

An even better question might be what kind of user you want to encourage.

relet
A: 

Put some JavaScript on your form similar to this:

script type="text/javascript" src="/js/public/jquery-latest.min.js" language="JavaScript"> // set no conflict mode for jquery var $jQ = jQuery.noConflict();

//edit this list with the domains you want to block

var invalidDomains = ["@gmail.com","@yahoo.com","@hotmail.com"];

function formSubmit(elt) { if (!isEmailGood()) { form.setError($jQ("#Email")[0],"The address must be from a business address, not a free service"); return false; } return form.formSubmit(elt); }

function isEmailGood() { for(i=0; i < invalidDomains.length; i++) { if ( $jQ("#Email[value*=" + invalidDomains[i] + "]").length > 0) { return false; } } return true; } /script>

shankapotomus