RE: [PHP] testing an email address

From: Date: Fri, 12 Oct 2001 21:35:58 +0000
Subject: RE: [PHP] testing an email address
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-70956@lists.php.net to get a copy of this message
On Fri, 12 Oct 2001, Michael Geier, CDM Systems Admin wrote: > That only checks formatting...there is no absolute test for validity. > > The only thing you can do is send an email to the address they supply and > force them to reply to it. I strongly agree with this point. You can make sure an email address has correct syntax, which is good, but entering a "real" email address is trivial. Using functions like getmxrr() is fine but what does it prove? Not much. Consider emailing the user and make them respond to your request. A common way is to provide a temporary "id". So, they'd be given an url in the email, something like : http://www.example.com/check.php?id=3kk39FH8Fbb3F3338Hf8h3F8f8jf5k35 Once confirmed as their assigned unique temporary "id" (someone goes to above url and it checks out okay), it's seen as valid/confirmed. It's not uncommon to set a time limit for their response either. Regards, Philip Olson > > -----Original Message----- > From: Intruder [mailto:intruder@mail.lv] > Sent: Friday, October 12, 2001 11:09 AM > To: Joseph Bannon > Cc: PHP (E-mail) > Subject: Re: [PHP] testing an email address > > > JB> Is there a PHP function to test whether an email address is valid or > not? > There is no such a function as for PHP4.0 ;))) > But you can use this one > > > function validmail($email) { > if(eregi("^[a-z0-9\._-]+@+[a-z0-9\._-]+\.+[a-z]{2,3}$", $email)) return > TRUE; > else return FALSE; > }; > > > > -- > 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 > > > > > -- > 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 (#70956) next »