Menu

OpenPop.NET 2.0

I have been working hard on getting OpenPop.NET to the next release.
There are good things and bad things about this release. We will start with the bad ones.

== TNEF ==
Microsoft's application/ms-tnef encapsulation of attachments is no longer supported.
It is an attachment to an email which can contain multiple message parts inside.
Why is it removed?
There were some issues i OpenPop 1.4 with encoding of characters that were not in the US-ASCII encoding. The problem with the TNEFParser was that it did not decode enough information to see what encoding was used.
If you feel this is a bad thing and have the guts to write such a parser, please contact me.

== Breaking changes ==
The new version includes lots and lots of breaking code changes - which is why OpenPop is going from 1.4 to 2.0.
Classes have been deleted
New classes have been created
Methods been renamed
Methods removed
Methods added
Namespaces changed
and so on...
If you have an existing codebase using OpenPop 1.4 it might be a considerable pain to move to OpenPop 2.0.

Now to the good stuff! Some of the breaking changes can also be seen as good and positive changes, but that is not the main interest here.

== The new message hierarchy ==
The old message hierarchy was a List of MessageBoddies, which only contained the body as a string and the Content-Type.
So actually, to old hierarchy was a flat list.

MIME Message hierarchies are not flat lists, and therefore in OpenPop 2.0 this hierarchy is represented like a tree.
At the root is the Message class which contains the top-level headers.
The Message class has one child, which is a MessagePart.

A MessagePart may be a MultiPart Message, which will have multiple children, or it may not be, in which case it only has one child.
There are methods in the Message class to help you find the MesagePart you are looking for (for example, the text/plain part or the text/html part).

== Much greater parsing ==
A lot, and I mean a LOT of bugs have been cleared out with regard to parsing.
Each time I have fixed a bug I have created a unit test, making sure that it is not going to be introduced again.

The biggest change in parsing is that emails are now stored as byte arrays - not as strings. They are also passed
as byte arrays from the Pop3Client to the Message class. Before it was as strings, which were read using some default encoding of the system. I many cases this resulted in a lot of questionmarks in the body of emails where some non-default encoding of characters had been used. This is not the case anymore.
Don't worry - it is still easy to get the body of a MessagePart as a string - just use the GetBodyAsText() method.

Other areas that have had improvement in parsing includes:
- Content-Disposition
- Mail addresses (to, from, CC ...)
- Content-Type
- Sender
- Dates
- ...

Also - worth mentioning is the QuotedPrintable decoder that I implemented. It is much more robust and fixed a lot of issues around the old decoder. I have not seen a single issue with it yet.

== IDisposable ==
The Pop3Client now implements the IDisposable interface making it possible to use it in a using statement.

== Logging ==
You can now implement a logging interface and use your preferred way to store log messages.

== Conversion to MailMessage ==
It is now possible to convert a Message to a System.Net.Mail.MailMessage making it very easy to send it off again using the .NET inbuilt SMTP client.

== OpenPop Test application ==
The test application has been upgraded to show the message hierarchy for each Message downloaded.
The topmost shown node tells the Message subject. Each subsequent node shows the MediaType of the MessagePart that the node represents.
I advise you to see this in action, making sure you understand the Message hierarchy before you begin with this new version.

== Website ==
OpenPop now has it's own website on sourceforge. It is located on http://hpop.sourceforge.net.
It includes documentation in HTML for the project. You can also download a .chm documentation file.
The pages also includes examples for some common uses of OpenPop.NET. Please check it out!

== Overview ==
In effect I think we are now having a project which includes a POP3 client and a very robust MIME parser. Feel free to bump me with bugs if you find any.

== Thanks to ==
John McDaniel for improvement suggestions and code commits. Also thank you for all the good discussions.
Thomas Thiery for nagging me with improvements - many of which improved the quality of the project.

Posted by foens 2013-06-12

Log in to post a comment.