473,395 Members | 1,846 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,395 software developers and data experts.

pop3 over sockets

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($socketPOP);
fputs($socketPOP, "USER myName\n");
fgets($socketPOP);
fputs($socketPOP, "PASS myPassword\n");
fgets($socketPOP);

// load list
fputs($socketPOP, "LIST\n");

Now I read the lines with
$zeile = fgets($socketPOP);
and get from it the current numbers and the content lengths.
Then I send for every mail:

fputs($socketPOP, "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

Jul 17 '05 #1
2 3196
Georg Gerber wrote:
Then I send for every mail:

fputs($socketPOP, "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?


You might want to review the POP3 protocol
http://www.faqs.org/rfcs/rfc1939.html

and use TOP instead of RETR
--
--= my mail box only accepts =--
--= Content-Type: text/plain =--
--= Size below 10001 bytes =--
Jul 17 '05 #2
Hello,

On 02/20/2004 09:51 AM, Georg Gerber wrote:
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


You may want to try this POP3 client class:

http://www.phpclasses.org/pop3class

--

Regards,
Manuel Lemos

PHP Classes - Free ready to use OOP components written in PHP
http://www.phpclasses.org/

PHP Reviews - Reviews of PHP books and other products
http://www.phpclasses.org/reviews/

Metastorage - Data object relational mapping layer generator
http://www.meta-language.net/metastorage.html
Jul 17 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: Rui | last post by:
I need to write a proxy between pop3 client and pop3+ssl server. This proxy will receive pop3 commands from the client and will translate those commands for a pop3+ssl server, then it will receive...
1
by: Ajeet YS | last post by:
Hello, Well, I don't know if this is the right forum to post this query, but I didn't find any other suitable one. I am developing a program to access mails from a pop3 server's mailbox. For...
2
by: Guoqi Zheng | last post by:
Dear sir, I am writing a pop3 component myself. After sending "RETR" command, I use below function to get the response from Pop server. For some pop servers, it works ok, but some other pop...
3
by: Craig Buchanan | last post by:
Is there a mechanism to montior a POP3 mailbox, then add the messagesa to a database? If not, I'm assuming that I'd need to build a service that would poll the POP3 account periodically, then...
3
by: Krach | last post by:
Hi everybody! I'm decided to develop (at least try) a custom pop3 connector / mail downloader for Exchange 2003. The question is simple: How do I start? I use MS Visual Studio 2003 (VB .Net). I...
2
by: Ken Yu | last post by:
Hi, I want to make a program for receive E-mail by POP3, and forward to another E-mail Account, if the E-mail with Attachment , will delete the attachment before forward, where can i find more...
8
by: Crouchie1998 | last post by:
I have written a POP3 class using sockets & it works perfectly fine. When I try and check an account like Gmail, which uses SSL, my program freezes. How do I make my POP3 class SSL compatible ...
1
by: Prasanta | last post by:
Hello, Please cnay one can tell me how to read mail as formatted.... i have made some code using that able to read but not able to serialize..... so am i need to parse the HTML, or is there any...
1
by: webmaster | last post by:
Request for assistance: I'm in process of writing a PoP3 class in VB.NET 2 (VS 2005), and have successfully managed to create a sub which will create a connection to a PoP3 server on port 110 to...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.