Solved

write a pop3 program

Posted on 1998-12-07
7
138 Views
Last Modified: 2010-08-05
I am writing a pop3 program and would like to know what the
good way to parse the mail or multipart mail body. In general practice, is it likely to finish popping a mail and then write the content to a temp file before parse the mailbody or analyse the data immediately once get the data?
which one is easier for coding?

Also, is there any reference about that especially parsing multipart body?

Actually, for some reasons, I should write the program. So, it seems no use if OCXs are suggested. However, it is most appreciated if there are source codes for reference. :)
Thanks

Actually,  
0
Comment
Question by:Torus
  • 4
  • 3
7 Comments
 
LVL 4

Expert Comment

by:anzen
ID: 1448534
Since You're working on a NET I think it's better to write all received data down to a temp file, then, when the message has been completely received split header from body (searching for the first "blank" line) and next parsing the two pieces, for more details about POP3 protocol see the RFC documents, You can easily find them on some sites (e.g. ftp://ftp.garr.it) the RFC which You'd read first are the 821, 822 and 1725

Bye.

0
 
LVL 2

Author Comment

by:Torus
ID: 1448535
Thanks for your answer.
 I understand the RFCs give me the idea of smtp and pop3. However, maybe my question is not clear,  I am concerning how to code the parsing mechanism. It seems quite complicated expecially the content-type is rfc822/message since it may contain another
header within the body.


0
 
LVL 2

Author Comment

by:Torus
ID: 1448536
Thanks for your answer.
 I understand the RFCs give me the idea of smtp and pop3. However, maybe my question is not clear,  I am concerning how to code the parsing mechanism. It seems quite complicated expecially the content-type is rfc822/message since it may contain another
header within the body.


0
Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

 
LVL 4

Accepted Solution

by:
anzen earned 100 total points
ID: 1448537
Well, first as I said You must split Your message into two pieces, that is Header and Body, the next thing to do is load the header into an array (one line at a time), now You should
scan the array with the following rule:

if the current array element begins with a valid char (not space or tab) it is a valid header entry, so save the array index and search the line for the ":" char indicating the end of the header token and the beginning of the header contents

if the current array element begins with a space or tab, it is a continuation line, so get the token from the previously bookmarked line and act as needed

If you have a multi-header message, simply split again the previously obtained body and repeat the parsing.

Alternatively You could get the free Internet Control Pack (ICP) from NetMasters' site at the following address:

http://www.netmastersllc.com/freeax2.html

Let me know...

0
 
LVL 2

Author Comment

by:Torus
ID: 1448538
I have finished the parsing mechanism. Anyway, thanks for your answer.

0
 
LVL 2

Author Comment

by:Torus
ID: 1448539
BTW, What's the control for?
0
 
LVL 4

Expert Comment

by:anzen
ID: 1448540
It's a control pack featuring POP3, SMTP, NNTP, HTTP, FTP and other OCX, it was formerly distributed by MS, now it's freely downloadable from the URL I mentioned above
0

Featured Post

Networking for the Cloud Era

Join Microsoft and Riverbed for a discussion and demonstration of enhancements to SteelConnect:
-One-click orchestration and cloud connectivity in Azure environments
-Tight integration of SD-WAN and WAN optimization capabilities
-Scalability and resiliency equal to a data center

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Article by: Martin
Here are a few simple, working, games that you can use as-is or as the basis for your own games. Tic-Tac-Toe This is one of the simplest of all games.   The game allows for a choice of who goes first and keeps track of the number of wins for…
If you need to start windows update installation remotely or as a scheduled task you will find this very helpful.
Get people started with the process of using Access VBA to control Outlook using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Microsoft Outlook. Using automation, an Access applic…
This lesson covers basic error handling code in Microsoft Excel using VBA. This is the first lesson in a 3-part series that uses code to loop through an Excel spreadsheet in VBA and then fix errors, taking advantage of error handling code. This l…

830 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question