Hi,
i try to write a small php email client, the problem
with the script is that i can't handle the server response,
the script ignores if the server lags and sent the requests
the script looks like this:
# open Socket.
$fp = fsockopen($serv er, $port);
if($fp) {
$result = fgets($fp, 1024);
# HELO
fputs($fp, "HELO ".randomip()."\ r\n");
$result = fgets($fp, 1024);
if ($result+0 != 220 || $result+0 != 250)
#die("HELO Statuscode falsch: $result");
# MAIL FROM
fputs($fp, "MAIL FROM: <".$firstname.$ lastname."@".$d omain.">\r\n");
$result = fgets($fp, 1024);
if ($result+0 != 250)
#die("MAIL FROM Statuscode falsch: $result");
the other problem is that the status codes (220/250) validation dont work
i have to use sleep(); timeouts and uncomment the die; parts to run the script
is there a better way to handle this?
regards
i try to write a small php email client, the problem
with the script is that i can't handle the server response,
the script ignores if the server lags and sent the requests
the script looks like this:
# open Socket.
$fp = fsockopen($serv er, $port);
if($fp) {
$result = fgets($fp, 1024);
# HELO
fputs($fp, "HELO ".randomip()."\ r\n");
$result = fgets($fp, 1024);
if ($result+0 != 220 || $result+0 != 250)
#die("HELO Statuscode falsch: $result");
# MAIL FROM
fputs($fp, "MAIL FROM: <".$firstname.$ lastname."@".$d omain.">\r\n");
$result = fgets($fp, 1024);
if ($result+0 != 250)
#die("MAIL FROM Statuscode falsch: $result");
the other problem is that the status codes (220/250) validation dont work
i have to use sleep(); timeouts and uncomment the die; parts to run the script
is there a better way to handle this?
regards
Comment