You could use MX records if you wanted to. I found this some time ago...

function checkEmail($Email) {
   //Do the basic Reg Exp Matching for simple validation
   if (eregi("[EMAIL PROTECTED]", $Email)) {
       return FALSE;
   }

   //split the Email Up for Server validation
   list($Username, $Domain) = split("@",$Email);

   //If you get an mx record then this is a valid email domain
   if(getmxrr($Domain, $MXHost)) {
       return TRUE;
   }
   else {
       //else use the domain given to try and connect on port 25
       //if you can connect then it's a valid domain and that's good enough
       if(fsockopen($Domain, 25, $errno, $errstr, 30)) {
           return TRUE;
       }
       else {
           return FALSE;
       }
   }
}

----- Original Message ----- 
From: "Blake Schroeder" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Thursday, December 04, 2003 2:31 AM
Subject: [PHP] validating email address


Whats the best way to validate email address (check for white space,
check for .com, .net.edu etc)

-Blake

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to