This is a more complex implementation of the same schema I used in XML Serialization and Firewalls.
The solution is composed of a Webservice that works as a proxy (it receives the request, connects to the POP3 server, and returns the processed answers) and a client that receives and presents the results to the user.
Basic experience on Webservices and network programming will help.
Using the Code
The code itself does not present any particular difficulty. But I've tried to keep a design where all component classes are clearly separated.
The Windows client is coded with a reference to the webservice hosted in the local host. This way the solution can be built quickly and easily, but you probably would like to point it to a webserver hosted outside the LAN where it wouldn't be blocked by the same firewall that blocks your browser.
The solution is composed of several projects.
These are the most general classes. You will find the class that implements the
EMail structure and the Quoted Text Decoder.
Probably not a good name. Here is where the communication with the POP3 server is handled and its answers are converted to the corresponding
EMail objects. The
POP3Manager that encapsulates the two previous classes and gives the user a much more friendly interface.
It exposes the
POP3Manager as a Webservice.
Windows Client (User Interface & Application Support)
The first one implements a Windows Forms user interface. The second is a simple class that handles the proxy class for the Web Reference.
This is a very basic build in a very early stage of development. The main purpose is to present a working implementation of the described solution. Currently it will show many limitations and bugs (both on the client and server side and many in the email parsing process).
You may notice the SMTP class. It is not implemented yet.
If feedback is provided or support requested, I'll keep working in this sample application.
- July 21st: POP3S (or POP3 over SSL) support added. Check
Pop3Client for changes. You will find that the protocol itself doesn't require any change, it is the
TcpClient that needs to be configured to properly handle the SSL stream. There is a new class named
SslManager. It is only providing the most basic support for these tasks and further development could be useful. I still haven't had time to modify the client interface to support this new feature.