Solved

write a pop3 program

Posted on 1998-12-07
7
135 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
Top 6 Sources for Identifying Threat Actor TTPs

Understanding your enemy is essential. These six sources will help you identify the most popular threat actor tactics, techniques, and procedures (TTPs).

 
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

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

Suggested Solutions

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…
Since upgrading to Office 2013 or higher installing the Smart Indenter addin will fail. This article will explain how to install it so it will work regardless of the Office version installed.
As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
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…

747 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

Need Help in Real-Time?

Connect with top rated Experts

10 Experts available now in Live!

Get 1:1 Help Now