[thelist] php and pop3 question

C*Money cmoney at www.dealergame.com
Mon Jun 17 22:53:01 CDT 2002


hey,

Im writing some php code to check a remote pop3 account, while I can connect
and see how many messages are available, when I do the "retr" command I have
problems with it getting the whole message.-I can get one or several of the
lines, but if i try to loop it I get a blank screen. I think this has
something to do with the sockets buffer?

here is what Im using:

function mail_get_message($messagenumber,$connection)
{
$sock = $connection;
echo "reading message:".$messagenumber;
fputs ($sock,"retr ".$messagenumber."\n\n");

    $buffer = fgets($sock, 4096);
echo $buffer;
}

now, how to make it loop?
the standard:
while (!feof ($fd)) {
    $buffer = fgets($fd, 4096);
    echo $buffer;

seems to have no effect...

am I missing something?
Cameron




More information about the thelist mailing list