chromonium
Programmer
Dear Experts,
I have found a free script on the net to detect whether a specified email address is valid....
How it is missing some things:
Character check,
and splitting of the original email address into $host and $user,
Your Help would be most appreciated in regards to this matter:
this is the code..:
<?PHP
class CEmail{
function check($host,$user){
$fp = fsockopen ($host, 25);
set_socket_blocking ($fp, true);
fputs ($fp, "Helo Local\n"
;
fgets ($fp, 2000);
fgets ($fp, 2000);
fputs ($fp, "Mail From:<$user@$host> \n"
;
fgets ($fp, 2000);
fputs ($fp, "RCPT to:aetos<$user@$host> \n"
;
$result= fgets ($fp, 2000);
$st= substr($result,0,3);
if ($st==250){
echo"Email address is valid";
}
else
echo"The address is not valid";
}
}
$m=new CEmail;
$m->check("acvilon.com","farkon"
;
?>
But this requires a valid host in the first place. Without a valid host the script returns errors. How can these errors be turned into a controlled response, ie return false so that the script returns that the email address cannot exist.
In addition to this the $host address seems to be in both and How can both of these versions of URL be tested, ie input is hello.com, and the script checks both versions, controlling errors.
Many Regards
Adam
I have found a free script on the net to detect whether a specified email address is valid....
How it is missing some things:
Character check,
and splitting of the original email address into $host and $user,
Your Help would be most appreciated in regards to this matter:
this is the code..:
<?PHP
class CEmail{
function check($host,$user){
$fp = fsockopen ($host, 25);
set_socket_blocking ($fp, true);
fputs ($fp, "Helo Local\n"
fgets ($fp, 2000);
fgets ($fp, 2000);
fputs ($fp, "Mail From:<$user@$host> \n"
fgets ($fp, 2000);
fputs ($fp, "RCPT to:aetos<$user@$host> \n"
$result= fgets ($fp, 2000);
$st= substr($result,0,3);
if ($st==250){
echo"Email address is valid";
}
else
echo"The address is not valid";
}
}
$m=new CEmail;
$m->check("acvilon.com","farkon"
?>
But this requires a valid host in the first place. Without a valid host the script returns errors. How can these errors be turned into a controlled response, ie return false so that the script returns that the email address cannot exist.
In addition to this the $host address seems to be in both and How can both of these versions of URL be tested, ie input is hello.com, and the script checks both versions, controlling errors.
Many Regards
Adam