Trouble with fsockopen and pop server HELP!!!
| From: | David Fordham | Date: | Wed, 01 Nov 2000 04:38:04 +0000 |
| Subject: | Trouble with fsockopen and pop server HELP!!! | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-23088@lists.php.net to get a copy of this message | ||
Hi all,
I am trying to write a PHP program to open up a mail account on a POP
server and move the mail to mail local machine for display on web (or
whatever). The problem is that the POP server (and I have tried many)
is not responding the way I expect based on what is in the RFC. The
code is below:
#!/usr/local/bin/php
<?php
$crlf = chr(13).chr(10);
$stdOpen = "\n<html><title>PHP Test Mail interface</title><body>";
printf("$stdOpen");
$mailserver = "mail.summittech.com";
$fp = fsockopen ($mailserver, 110, &$errno, &$errstr, 30);
if (!$fp)
{
echo "$errstr ($errno)<br>\n";
}
else
{
$problem = "QUIT";
//$problem = "USER chrispin";
fputs ($fp, "$problem $crlf");
while (!feof($fp))
{
echo fgets ($fp,128);
}
fclose ($fp);
}
?>
</body>
</html>
_________________
The mail server(s) only respond when $problem = QUIT and then it
responds appropriately and quits, every other POP command issued hangs
and I am at wits end on figuring out why.
Help Please.
David
PS. I know that I could use the imap commands but, unfortunately, my
ISP has not compiled PHP v 3.0.9 with the c client lib and "--with-imap"
so those are not available to me.
Thanks again.