Could someone please help me fix this.For what ever reason i get a couldnt open/find page when i try to use this. I believe it has to do with the actuall connecting to the server, because it works when i cut it out.
function checkEmail($Email)
{
global $HTTP_HOST;
$result = 0;
if (!eregi("^[_a-z0-9-]+(\.[_a-z0-9-]+)*@[a-z0-9-]+(\.[a-z0-9-]+)*(\.[a-z]{2,3})$", $Email))
{
return 0;
}
list ( $Username, $Domain ) = split ("@",$Email);
if (getmxrr($Domain, $MXHost))
{
$ConnectAddress = $MXHost[0];
}
else
{
$ConnectAddress = $Domain;
}
$Connect = fsockopen ( trim($ConnectAddress), 25 );
if ($Connect)
{
if (ereg("^220", $Out = fgets($Connect, 1024)))
{
fputs ($Connect, "HELO $HTTP_HOST\r\n");
$Out = fgets ( $Connect, 1024 );
fputs ($Connect, "MAIL FROM: <'ryan@ryanssoftware.com'>\r\n");
$From = fgets ( $Connect, 1024 );
fputs ($Connect, "RCPT TO: <{$Email}>\r\n");
$To = fgets ($Connect, 1024);
fputs ($Connect, "QUIT\r\n");
fclose($Connect);
if (!ereg ("^250", $From) || !ereg ( "^250", $To ))
{
die("Server Error or Id and domain doesn't exist");
}
fclose($Connect);
}
else
{
die("Server Error or Id and domain doesn't exist");
}
}
else
{
die("Server Error or Id and domain doesn't exist");
}
return 1;
}
Any help is greatly appreciated.