Revision: 22719
Initial Code
Initial URL
Initial Description
Initial Title
Initial Tags
Initial Language
at January 20, 2010 06:51 by giak
Initial Code
// PHP.ini : allow_call_time_pass_reference = On // somenone can override this ? function neo_mailCheck($Email){ // email well formatted ? can use SANITIZE stuff if(!preg_match('`^[[:alnum:]]([-_.]?[[:alnum:]])*@[[:alnum:]]([-_.]?[[:alnum:]])*\.([a-z]{2,4})$`', $Email)){ exit('Email adress '.$Email.' not well formatted'); } // Get domain list(,$domain ) = split('@',$Email); // Cherching data MX in DNS if (getmxrr($domain, $MXHost)){ $ConnectAddress = $MXHost[0]; } else { $ConnectAddress = $domain; } // Creating connexion on smtp port (25) $Connect = @fsockopen($ConnectAddress,25,&$errno,&$errstr); if($Connect){ // test return 220 if(preg_match('/^220/', $Out = fgets($Connect, 1024))){ fputs ($Connect, "HELO {$_SERVER['HTTP_HOST']} "); $Out = fgets ( $Connect, 1024 ); fputs ($Connect, "MAIL FROM: <{$Email}> "); $From = fgets ( $Connect, 1024 ); fputs ($Connect, "RCPT TO: <{$Email}> "); $To = fgets ($Connect, 1024); fputs ($Connect, "QUIT "); fclose($Connect); // If command RCPT TO returns 250 ou 251 (cf: RFC) // Son email exist if (!preg_match ('/^250/', $To) && !preg_match ('/^251/', $To)){ // Adress rejected by server return false; } else { // Adress accepted by server return true; } } else { // Server not answered return false; } } else { // Login on mail server impossible // You can see error with this : // echo $errno."-".$errstr; return false; } }
Initial URL
http://www.giacomel.fr
Initial Description
Initial Title
PHP : Powerfull testing mails
Initial Tags
list
Initial Language
PHP