473,563 Members | 2,767 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Email Validate with exclude

I am looking to do some email validation and many of the scripts I've located
online are great basic email validators.

They check to see that the email address is something along the lines of
somethin@a_vali d_host.at_a_valid_tld

Thats great, looking for that, BUT

I then want to EXCLUDE certain domains, ie: webmail hosts, or what ever hosts I
add to a list.

I want to work this with my basic update form which gets sent via the a CGI
script form mail item

User fills out form
clicks submit
JS checks to see if its a valid email address AND NOT a webmail or other
excluded hosts address. If so then submits via my normal formmail.pl script.

Any one already invented this?

Thanks in advance!
----== Posted via Newsfeeds.Com - Unlimited-Uncensored-Secure Usenet News==----
http://www.newsfeeds.com The #1 Newsgroup Service in the World! 120,000+ Newsgroups
----= East and West-Coast Server Farms - Total Privacy via Encryption =----
Jul 23 '05 #1
6 2110
xx***********@t ampascanner.inf o wrote:
I am looking to do some email validation and many of the scripts I've located
online are great basic email validators.

They check to see that the email address is something along the lines of
somethin@a_vali d_host.at_a_valid_tld

Thats great, looking for that, BUT

I then want to EXCLUDE certain domains, ie: webmail hosts, or what ever hosts I
add to a list.

I want to work this with my basic update form which gets sent via the a CGI
script form mail item

User fills out form
clicks submit
JS checks to see if its a valid email address AND NOT a webmail or other
excluded hosts address. If so then submits via my normal formmail.pl script.

Any one already invented this?


And if JS is disabled? Meaning, you should be double checking on the
server anyway. But, you can exclude by host simply by checking for the
indexOf('domain ToAvoid') and if they are in array then you can loop
through the array:

var nonAccepted;
var blockedDomains = new Array('','',''. ......);
bDL = blockedDomains. length;
for (var i=0;i<bDL;i++){
if (domainName == blockedDomains[i]){
alert('Blocked Domain');
nonAccepted = true;
}
}

And then at the end you check nonAccepted and if its true, you return
false to the onsubmit handler and not submit the form.

--
Randy
comp.lang.javas cript FAQ - http://jibbering.com/faq & newsgroup weekly
Jul 23 '05 #2
ASM


xx***********@t ampascanner.inf o a ecrit :

I am looking to do some email validation and many of the scripts I've located
online are great basic email validators.

They check to see that the email address is something along the lines of
somethin@a_vali d_host.at_a_valid_tld

Thats great, looking for that, BUT
I want
User fills out form
clicks submit
JS checks to see if its a valid email address AND NOT a webmail or other
excluded hosts address. If so then submits via my normal formmail.pl script.

Any one already invented this?
if you have a list of urls or domains you insert it in your JS
and it is not a good idea because anyone can read it

hate_hosts = 'aol.com,xxxnon exnoneexx,tampa scanner';

function submiter() {
var foo = document.myForm .theEmail.value ;
// code you have to verify url
var hate = hate_hosts.spli t(','); // hate_hosts -> becomes new array
var ok=true; // or nothing if 'ok' exists in precedent code
if(ok)
for(var i=0;i<hate.leng th;i++)
if(foo.toString ().indexOf(hate[i])>=0) {
ok=false;
alert('This host "'+hate[i]+'" is not accepted');
}
return ok;
}
</script>
<form name="myForm" action="page.ht m" onsubmit="retur n submiter();">

submiter() must return true or false
so take care that you have to arrange your code to obtain in its end
the right command
Thanks in advance!


anyway JS yould only be an help
and the form must be submitted if JS is disabled

--
*************** *************** *************** **********
Stéphane MORIAUX et son vieux Mac
*************** *************** *************** **********
Jul 23 '05 #3

<xx***********@ tampascanner.in fo> wrote in message news:gq******** *************** *********@4ax.c om...
I am looking to do some email validation and many of the scripts I've located
online are great basic email validators.

They check to see that the email address is something along the lines of
somethin@a_vali d_host.at_a_valid_tld

Thats great, looking for that, BUT

I then want to EXCLUDE certain domains, ie: webmail hosts, or what ever hosts I
add to a list.

I want to work this with my basic update form which gets sent via the a CGI
script form mail item

User fills out form
clicks submit
JS checks to see if its a valid email address AND NOT a webmail or other
excluded hosts address. If so then submits via my normal formmail.pl script.

Any one already invented this?


No, but I've made a simple addition to an existing script. It tests the basic address format without searching
for illegal characters, giving a descriptive message of any error. Then it checks for unwanted domains with
any suffix: .fr or co.uk etc, so just add basic names to the list. It picks-up .....@mail.unWa nted.etc. It
will not pick-up ya********@anAc ceptedHost.etc or xx*@hotmailHate rs.etc

Having said that, I expect that most typos are undetectable in that they don't break the basic format. Also,
you cannot expect realistically to detect all webmail hosts, and it may not be too tactful to tell a user that
you're not enamoured of his/her email address.

<script type='text/javascript'>

function emTest(emString , showMessage)
{ // S Chalmers 2005

var badHosts=["usa","msn","ho tmail","yahoo", "pointedEar s"];

var emaData=
/\,/, false, "Comma (,) found",
/\s/, false, "Spaces not allowed",
/@/, true, "No @ sign",
/@.*@/, false, "More than one @",
/^@/, false, "Nothing preceding @",
/\.@/, false, "@ preceded by '.'",
/@\./, false, "@ followed by '.'",
/@.+\./, true, "No '.' anywhere after @",
/\.\./, false, "=>..",
/^\./, false, "Cannot start with '.'",
/\.$/, false, "Cannot end with '.'",
/.+\.[a-z]{2,}$/i, true, "Must end with 2 or more letters"
];
var ok=true, dl=emaData.leng th, hl=badHosts.len gth;

emString=emStri ng.replace(/^\s+|\s+$/g,'');

for(var i=0; i<dl && ( emaData[i].test( emString ) ^ !emaData[i+1] ); i+=3)
;

if(i!=dl)
{
ok=false;
if(showMessage)
alert("Error in format of e-mail address:\n\n" + emString + "\n\n" + emaData[i+2]);
}
else
{
for(var j=0; j<badHosts.leng th && !new RegExp("[@.]"+badHosts[j]+"\\.","i").tes t(emString); j++)
;

if(j!=hl)
{
ok=false
if(showMessage)
alert("Excluded mail host [ "+badHosts[j]+" ]");
}
}
return ok;
}

</script>

<FORM onsubmit="retur n false">
<input size="50" type="text" name='ema'><BR>
<input type="button" onclick="emTest (this.form.ema. value, true)" value='TEST'>
</FORM>

--
Stephen Chalmers http://makeashorterlink.com/?H3E82245A

547265617375726 520627572696564 206174204F2E532 E207265663A2054 51323437393134
Jul 23 '05 #4
On Wed, 08 Jun 2005 00:20:12 +0200, ASM <st************ *********@wanad oo.fr>
wrote:

if you have a list of urls or domains you insert it in your JS
and it is not a good idea because anyone can read it
Thanks for the script. I work thru several to meet my needs.
anyway JS yould only be an help
and the form must be submitted if JS is disabled


No or disabled JS sent to a page that states you must enable ..... otherwise
they will not be able to submit the form which is a required part of the
registration.

Thanks again for the input, and to all that replied so far. All very helpful.
----== Posted via Newsfeeds.Com - Unlimited-Uncensored-Secure Usenet News==----
http://www.newsfeeds.com The #1 Newsgroup Service in the World! 120,000+ Newsgroups
----= East and West-Coast Server Farms - Total Privacy via Encryption =----
Jul 23 '05 #5
On Tue, 07 Jun 2005 17:48:54 -0400, Randy Webb <Hi************ @aol.com> wrote:
And if JS is disabled?
They will be sent to a page stating NO JS they can not complete the next step.
Meaning, you should be double checking on the
server anyway
I would LOVE to, but I am stuck with a host who has selected the formmail script
thats allowed, and thats it. No other formmail scripts are allowed. Attempting
to add your own risks termination of the account. I understand the issue with
abuse/hijack SPAM etc., so thats the breaks. Other domains on other hosts have
had their formmail abilities totally removed, scripts for that not allowed, none
provided by host.
. But, you can exclude by host simply by checking for the
indexOf('domai nToAvoid') and if they are in array then you can loop


Thanks for the info greatly appreciated.

----== Posted via Newsfeeds.Com - Unlimited-Uncensored-Secure Usenet News==----
http://www.newsfeeds.com The #1 Newsgroup Service in the World! 120,000+ Newsgroups
----= East and West-Coast Server Farms - Total Privacy via Encryption =----
Jul 23 '05 #6
On Wed, 8 Jun 2005 01:56:25 +0100, "Stephen Chalmers" <ig******@lycos .co.uk>
wrote:
you cannot expect realistically to detect all webmail hosts, and it may not be too tactful to tell a user that
you're not enamoured of his/her email address.


It may not be "too tactful" but this is the name of the game for this situation.
I've asked politely do not submit yahoo, hotmail, gmail etc.. I still get them,
and reject them. Then I get the nasty email, > /dev/null. You can play by the
rules or you will not be allowed to join. One of those rules is that a real
email address must be used not some address at yahoo, hotmail, gmail etc. that
any user can create 50,000 of them at a time.

Thanks for the input and script.
----== Posted via Newsfeeds.Com - Unlimited-Uncensored-Secure Usenet News==----
http://www.newsfeeds.com The #1 Newsgroup Service in the World! 120,000+ Newsgroups
----= East and West-Coast Server Farms - Total Privacy via Encryption =----
Jul 23 '05 #7

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

25
6454
by: Dynamo | last post by:
Hi The following script was taken from John Coggeshall's (PHP consultant) in his article on Zends site at http://www.zend.com/zend/spotlight/ev12apr.php // Get the email address to validate $email = $_POST // Use John Coggeshalls script to validate the email address if(!eregi("^+(\.+)*@+(\.+)*(\.{2,3})$", $email) { echo "The e-mail was...
17
4897
by: Sue | last post by:
<html> Is there someone here that can help me validate the period as the fourth from the last character in an email address. There is other information and validation on the form I have to do but the period in the email address is the only part I am having problems with. I have posted part of my code below. Any help would be greatly...
2
6614
by: Doug | last post by:
I'm a little confused by this functionality. It doesn't seem to be behaving like it should. I am using the following regular expression to validate email addresses: "\w+(\w+)*@\w+(\w+)*\.({2,4})\040*". From what I can determine it should validate the following rules: 1. BEFORE THE AMPERSAND A. Must contain at least one alphanumeric...
11
8534
by: Brian Henry | last post by:
I have a domain cluster with AD running, and I want to lookup a users email address (exchange 2000 server is integrated with the AD system) so i can email the user based on their user name. does anyone know how to look up the email address? i would just use the user name as the alias but not all our user names match their internal email...
7
1305
by: Dragon | last post by:
Hi, I am trying to find out if there is a good (Built-in?) way to validate text input. I would like to check a textbox to see whether user enter a proper name (without numbers, symbols etc) or if it is a valid phone number (no letters or symbols) etc or not. Right now I am sending the string to a subroutine that check it each letter at a...
2
1952
by: Arsen V. | last post by:
Hi, How to exclude the App_Data directory from Visual SourceSafe? It appears that Vs 2005 automatically adds the App_Data directory with the large binary MDF and LOG files to the Visual SourceSafe. Is there a way to prevent this from happening? Thanks,
12
17586
by: adzir | last post by:
Hi, I need to validate password keyed in by the system users so that the password will contain only letters and numbers plus at least one capital letter. Exclude these symbols , < ? / * ( ) & ^ % $ # ! ~ ` " ' this is my code:
5
1867
by: Ganesh | last post by:
Hi There, I need to validate email address with regular expression control, i tried something like this ^+*@*\.*$ but i need to validate even if it is blank, it should say invalid email, but don't want to use another requirefield validator
0
1056
by: novus | last post by:
could anyone tell me if there is anything wrong with this script we seem to be unable to make the script/eventsink work on our exchange2003 server. <SCRIPT LANGUAGE="VBScript"> Sub ISMTPOnArrival_OnArrival(ByVal Msg, EventStatus) TextDisclaimer = vbCrLf & "DISCLAIMER:" & vbCrLf & "The information contained in this e-mail may be...
0
7665
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main...
0
7583
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language...
0
8106
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that...
0
7950
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the...
0
6255
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then...
0
5213
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert...
0
3643
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in...
0
3626
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
1200
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.