Edit: My Website is offering a service to Gmail and Google Apps users only, and do wanted to make sure that others free email users doesn't get an error message when they initiate the oauth pairing.
so here is the deal : either I try to figure out that's a Gmail/Google Apps address, or try to prevent popular free mail users from trying to subscribe.
I want to prevent all "free" email addresses that belongs to Gmail, Hotmail, Yahoo, etc... from subscribing in my website.
How can I do that correctly in javascript?
Here a first script I have developped :
var domain_matche = /@(.*)$/.exec(email);
var domain_name = domain_matche[1].substring(0, domain_matche[1].indexOf(".", 0))
if (domain_name == "hotmail" || domain_name == "yahoo" ) {
alert("not a valid email");
}
But it doesn't detect email like test@hotmail.co.il or test@subdomain.hotmail.com.
Could you please help? Thanks a lot!
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…