Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

e-mail address verification 1

Status
Not open for further replies.

ProgrammerKC

Programmer
Oct 12, 2000
7
US
I am writing a Perl script which produces an HTML page. In the HTML page there is a form where users input various information including their e-mail address. Is there any way for the Perl script to verify the e-mail address? I know how to verify the domain name, but is there any way to verify that the user's e-mail account actually exists on that domain?

THANKS!
 
You need find a book "CGI Programming with Perl" Second Edition. Authors: Scott Guelich, Shishir Gundavaram and Gunther Birznieks. O'RELLY. You will find there about how to verify e-mail address.
I hope it help for you.
Andrei Voronetski from Kaliningrad Russia.
 
Sure.. theortically, you send a test mail to the server, and act on the response.. if the mail is unreachable, or returned you should get an error message, i think
(bare with me here.. not used perl to send mail recently)
Myabe this will provoke someone bettered qualified into thought?

Hope this helps
Sib
Siberdude
siberdude@settlers.co.uk
 
I think the perl book mentioned will tell you how to VALIDATE that an email address is syntactically correct, but probably won't tell you how to VERIFY that it actually exists. I'm not sure of any good method to do this except, as was mentioned, send a test message and look for an error response, but that's not very convenient. You might check out and see if they have a module to do it.
Tracy Dryden
tracy@bydisn.com

Meddle not in the affairs of dragons,
For you are crunchy, and good with mustard.
 
Hmm.. not sure if that would be possible to do on-the-fly so to speak. I say this only because it can take varying lenghts of time to get a response back from a legitimate mail server (depends on many things as to how fast server responds.)

Thats why many people opt to send users verification URL's with their registration requests etc. So that only valid email addresses are used.

I guess it would depend on what you were needing to verify it for.

Opp.
 
i can say (having the oreilly book) its not want u want
and personaly i dont recomend this book.... someone knowledge ends where
someone else knowledge starts
 
It is not possible to validate an email address directly. The only effective stratagy is to send and email to their reported address with some content they need to give you back and associate the infromation with a user name.

tsdragon is correct that the O'reily will give you the code to validate the proper syntax of the address ie mine ekhaunter@hotmail.com. You just need to check to make sure the address contains a @ and a period(.).
 
KC I preferr this little piece of java script to validate the email. If you dont have a bandwidth issue, adding this to the form will validate the email syntax on the client side before the cgi ever sees the address. This will save a few cpu clock cycles on the server. Neither way is incorrect only prefererence and conditions of the server and bandwidth.

var re = new RegExp("^.+\\@(\\[?)[a-zA-Z0-9\\-\\.]+\\.([a-zA-Z]{2,3}|[0-9]{1,3})(\\]?)$");

function valid(){

var mail1=document.RequestLogin.pwemail1.value;

if(!re.test(mail1)){
alert("You must enter a valid email address in the 'Email Address' field");
return false;
}
else return true;
}
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top