Hello,
on a php page I want to display the content of a POP3 mailbox and to show
the following informations:
current number, content-length, sender, subject
I use the following code:
// open the socket
$socketPOP = fsockopen($pop, 110);
fgets($socketPO P);
fputs($socketPO P, "USER myName\n");
fgets($socketPO P);
fputs($socketPO P, "PASS myPassword\n");
fgets($socketPO P);
// load list
fputs($socketPO P, "LIST\n");
Now I read the lines with
$zeile = fgets($socketPO P);
and get from it the current numbers and the content lengths.
Then I send for every mail:
fputs($socketPO P, "RETR $currentNumber\ n");
and parse the returnd lines for the strings "From:" and "Subject:".
My problem is, that the whole mail is sended and I have to read ALL data
from the socket, before I can get the data from the next mail. If I have
lots of large mails, I create with this code very much traffic.
How can I avoid this unnecessary traffic?
Georg Gerber
on a php page I want to display the content of a POP3 mailbox and to show
the following informations:
current number, content-length, sender, subject
I use the following code:
// open the socket
$socketPOP = fsockopen($pop, 110);
fgets($socketPO P);
fputs($socketPO P, "USER myName\n");
fgets($socketPO P);
fputs($socketPO P, "PASS myPassword\n");
fgets($socketPO P);
// load list
fputs($socketPO P, "LIST\n");
Now I read the lines with
$zeile = fgets($socketPO P);
and get from it the current numbers and the content lengths.
Then I send for every mail:
fputs($socketPO P, "RETR $currentNumber\ n");
and parse the returnd lines for the strings "From:" and "Subject:".
My problem is, that the whole mail is sended and I have to read ALL data
from the socket, before I can get the data from the next mail. If I have
lots of large mails, I create with this code very much traffic.
How can I avoid this unnecessary traffic?
Georg Gerber
Comment