Friday 11 April 2008

Fetching and processing POP3 email in C#.NET

This is a problem that plagued the first three hours of my day, and was solved by the incredibly handy OpenPop.NET. I played with two other POP-related products including one entry on TheCodeProject.com, but with not much in the way of luck.

I was really impressed with OpenPop.NET because I was able to create a POP3 solution that:

  1. Connected to a POP server.
  2. Fetched some email.
  3. Checked the attachments for the ContentType of text/xml.
  4. If it was XML, I then processed and saved the XML to disk.

All of the above took a grand total of 60 minutes to complete, and all of this was without any documentation (I think it's a side-project of two developers who haven't gotten around to documenting it yet), which speaks volumes for the simplicity of its design and the properties and methods it exposes.

Source code is below just in case you get stuck. Obviously you'll need to introduce some error trapping.


That URL again - http://sourceforge.net/projects/hpop/!