You are here: mail validate not working with hotmail « All PHP « IT news, forums, messages
mail validate not working with hotmail

Posted by Sander on 09/19/05 13:25

Hi,

I am running a php script that does a realtime check on valid emailadresses.
It works quit good on many mailservers but not on hotmail. I downloaded the
script from a website and modified it (the orginal has the same problems).

**** code snippet starts here ****
function validate_mail($to,$from)
{

list($me,$mydomain) = split("@",$from);

// Now look up the mail exchangers for the recipient
list($user,$domain) = split("@",$to,2);
if(getmxrr($domain,$mx,$weight) == 0) return FALSE;

// Try them in order of lowest weight first
array_multisort($mx,$weight);
$success=0;

foreach($mx as $host) {
// Open an SMTP connection
$connection = fsockopen ($host, 25, &$errno, &$errstr, 1);
if (!$connection)
continue;
$res=fgets($connection,256);
if(substr($res,0,3) != "220") break;
print("Open connection: $res<br><br>");

// Introduce ourselves
fputs($connection, "HELO $mydomain\n");
$res=fgets($connection,256);
if(substr($res,0,3) != "250") break;
print("HELO respons: $res<br><br>");

// Envelope from
fputs($connection, "MAIL FROM: $from\n");
$res=fgets($connection,256);
if(substr($res,0,3) != "250") break;
print("MAIL FROM respons: $res<br><br>");

// Envelope to
fputs($connection, "RCPT TO: $to\n");
$res=fgets($connection,256);
if(substr($res,0,3) != "250") break;
print("RCPT TO respons: $res<br><br>");

// Say bye bye
fputs($connection,"QUIT\n");
$res=fgets($connection,256);
if(substr($res,0,3) != "221") break;
print("QUIT: $res<br><br>");

$success=1;
break;
}

if($connection) {
if($success==0) fputs($connection, "QUIT\n");
fclose ($connection);
}
return $success?TRUE:FALSE;
}

$result = validate_mail("blabla@hotmail.com",johndoe@hotmail.com)

**** code snippet ends here ****

Hotmail stops responding when the connection is made. All other tested
providers work all the way to the end. Anyone an idea how to solve this?

Thanks in advance,

Sander Swuste

 

Navigation:

[Reply to this message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация