Click here to Skip to main content
65,938 articles
CodeProject is changing. Read more.
Articles / web / ASP.NET

POP3 Client Over Firewall

3.45/5 (8 votes)
21 Jul 20072 min read 1   737  
A webservice implementation to connect to POP3 servers
Screenshot - POP3Proxy.gif

Introduction

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.

Background

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.

Component Projects

The solution is composed of several projects.

Base Elements

These are the most general classes. You will find the class that implements the EMail structure and the Quoted Text Decoder.

EMail Support

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.

WebService

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.

Pendings

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.

History

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 Pop3Manager and 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.

License

This article has no explicit license attached to it but may contain usage terms in the article text or the download files themselves. If in doubt please contact the author via the discussion board below.

A list of licenses authors might use can be found here