Re: checking if e-mail address and syntax are valid

From: Date: Wed, 25 Apr 2001 14:50:35 +0000
Subject: Re: checking if e-mail address and syntax are valid
References: 1 2  Groups: php.general 
Request: Send a blank email to php-general+get-50309@lists.php.net to get a copy of this message
I wrote a similar script of my own... Works fine for me function email_valid($email) { $pattern="^[0-9a-zA-Z_-]+(\.[0-9a-zA-Z_-]+)*@[0-9a-zA-Z_-]+(\.[0-9a-zA-Z_-]+ )+$"; return ereg($pattern, $email); } (returns false if email is not valid, true if it is) N "Martin Skjöldebrand" <chimbis@skjoldebrand.org> wrote in message news:9c4npf$ojq$1@toye.p.sourceforge.net... > Carlos Fernando Scheidecker Antunes wrote: > > > Hello all! > > > > I would like to know if anyone has or know any PHP code to verify if a > > form entered e-mail address is valid? > > > > I would like that things like 4$%^%$@@.com.br could not be sent. I only > > has to verify the syntax of it, the existance I believe should be harder > > to verify but if it is possible I would be glad if anyone could point me > > the way. > > This is taken from PHP Developers Cookbook. Don't ask me exactly what it > does, because I don't know. I think I can grasp the basics of it though. > It isn't fool proof tho. > > > if (!eregi ("^([a-z0-9_]|\\-|\\.)+@(([a-z0-9_]|\\-)+\\.)+[a-z]{2,4}$", > $users)) die ("Invalid email"); > > M. > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, e-mail: php-general-unsubscribe@lists.php.net > For additional commands, e-mail: php-general-help@lists.php.net > To contact the list administrators, e-mail: php-list-admin@lists.php.net >

« previous php.general (#50309) next »