RE: [PHP] email validation string.

From: Date: Fri, 19 Jan 2007 16:01:28 +0000
Subject: RE: [PHP] email validation string.
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-247404@lists.php.net to get a copy of this message
hi... the real problem you have with email validation is that the vast majority of the email validation scripts that you see in various apps only handle a part of what the wc3/spec states to be valid email addresses. if your app had the ability to handle the time constraint, a reasonable approach would be to simply fire off a msg to the email address and check the return status code! if you're really going to try to get a function to validate email addresses, and you're concerned about the outlying address types, then you're going to wind up with an ugly/hairy/complex situation. awhile ago, in taking the path least traveled, i punted this issue, and used a 'perl' function that i call from php to handle it... does it take a little longer, sure... but i decided it was worth it.... peace.. -----Original Message----- From: Roman Neuhauser [mailto:neuhauser@sigpipe.cz] Sent: Friday, January 19, 2007 2:17 AM To: WeberSites LTD Cc: 'Don'; php-general@lists.php.net Subject: Re: [PHP] email validation string. # berber@weber-sites.com / 2007-01-19 10:55:21 +0200: > From: Don [mailto:don.rzeszut@gmail.com] > > I'm trying to get this line to validate an email address from a form and it > > isn't working. > > > > if (ereg("^.+@.+\..+$",$submittedEmail)) > > > > The book I'm referencing has this line > > > > if (ereg("^.+@.+\\..+$",$submittedEmail)) 1. Why did you remove the backslash? (the original was correct) 2. What do you expect the regexp to match? 3. Define "it isn't working". > Try this : http://www.weberdev.com/get_example-3274.html This will reject addresses that use greylisting, and 600 lines in a single function is gross. I wouldn't touch that. -- How many Vietnam vets does it take to screw in a light bulb? You don't know, man. You don't KNOW. Cause you weren't THERE. http://bash.org/?255991 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php

« previous php.general (#247404) next »