Re: Checking for a Valid Email String.

From: Date: Wed, 12 Mar 2003 02:37:50 +0000
Subject: Re: Checking for a Valid Email String.
References: 1 2 3 4  Groups: php.general 
Request: Send a blank email to php-general+get-139210@lists.php.net to get a copy of this message
On Wed, 12 Mar 2003 14:42:04 +1300, Philip J. Newman <newmanpj@philipnz.com> wrote:
how ever i don't think most ISPs let users pick names with the + sign in it ----- Original Message ----- From: "Paul Chvostek" <paul+php@it.ca> To: "David E.S.V." <sanchez.de@pucp.edu.pe> Cc: "Philip J. Newman" <newmanpj@philipnz.com>; <php- general@lists.php.net> Sent: Wednesday, March 12, 2003 2:37 PM Subject: Re: [PHP] Checking for a Valid Email String. On Wed, 12 Mar 2003, Philip J. Newman wrote:
Required: Help for checking for a valid email string. On Tue, Mar 11, 2003 at 08:19:36PM -0500, David E.S.V. wrote:
you mean something like this? //checking if the email is valid if (eregi("^[0-9a-z]([-_.]?[0-9a-z])*@[0-9a-z]([-.]?[0-9a-z])*\\.[a- z]{2,3}$", $email, $check)) { if ( !getmxrr(substr(strstr($check[0], '@'), 1), $validate_email_temp) )
    $mensaje="server not valid";
// checking DNS if(!checkdnsrr(substr(strstr($check[0], '@'), 1),"ANY"))
     $mensaje="server not valid";
}
Don't forget plus signs. When providing email addresses to lists and web sites, I regularly tag my address (as the From address on this message demonstrates). Using procmail for local delivery allows these addresses to be delivered to my account, and I can more easily track down the origin of "tagged" spam. When I come across a web site or list that doesn't allow my address with a plus sign, I find another site or list. So I use: function isvalidemail($what) { if
(!eregi('[a-z0-9][a-z0-9._=+-]*@([a-z0-9][a-z0-9-]*\.)+[a-z][a- z]+$',$what)) return(false);
list($user,$domain) = explode("@",$what); if (!getmxrr($domain,$mxhosts)) return(false); if (!count($mxhosts) > 0) return(false); return(true); } --
Paul Chvostek                                             <paul@it.ca>
Operations / Abuse / Whatever
it.canada, hosting and development                   http://www.it.ca/
What about those of us who run our own mailservers? A plus sign is a valid character in an email address. Doesn't matter if places like AOL don't let their users put it in their user's email addresses. There's no point in *not* allowing it, since it *is* a valid character. -- Using M2, Opera's revolutionary e-mail client: http://www.opera.com/m2/

« previous php.general (#139210) next »