Comparison of .Net libraries for fetching emails via POP3

Sending emails in C# is easy; for basic use cases you don’t need external resources to send a note because .NET BCL already ships it. On .Net Developer Center, there’s a short description how to do it.

Now, how to fetch the email? It turns out it is not that easy – it’s not supported by .Net BCL. I spent a while researching for the best library that matched my purposes and I want to share my views on a couple of components I looked at.

Note: Please bear in mind I was interested only in a small piece of functionality such library could provide. My need was only to fetch an email (in plain text) with attachments. That was supposed to be done via POP3. I was not really interested in features like advanced sending emails (e.g. email templates), request and delivery receipts, support for iCalendar, email in HTML, etc. To sum up, I did not test libraries from that angle and therefore this comparison will not suit needs of all developers.

CSLMail v2.0

WinToolZone has released CSLMail. It’s easy to use and quite convenient but I had two major problems:

  • retrieve email body – problems with MIME format – the retrieved text contained equality characters in several places, and mixed line endings ‘\r\n’ vs. ‘=0A=0D’ (although each line of the email was prepared in exactly the same way). Combination of search/replace? Forget it – too risky
  • attachment – when I was trying to fetch email with an attachment, the code just threw an exception (there was a problem with String.Substring call while fetching the message)

It is possible the problems were on my side only (e.g. mail server), but anyway, it didn’t work icon sad Comparison of .Net libraries for fetching emails via POP3 It’s a pity there’s hardly anything on internet about that component and I failed to get more help from the package I had downloaded from CSLMail homepage.

If you had similar problems or, on contrary, everything worked fine on your side, could you please share your opinions?

OpenPOP.NET

This library is available at sourceforge. I was able to fetch a TXT email with an attachment, but the email text was seen as an attachment (I could live with it) not anything like a body. The attachment, though, was not retrievable at all.

Again, maybe it’s my fault but I couldn’t fix it in a reasonable time. So I gave up again…

Mail.dll

Mail.dll is not available for free but there’s an evaluation version available to download so before you buy it you can check how it works. That version adds an annoying string to email subject so, in general, if you can leave with it you can stick to it. However, I’m afraid for more professional use that’s not an option.

A few comments:

  • fetching emails with attachments was really easy and worked like a charm
  • automatic email parsing when fetched from server – I get exactly the same text Outlook displays
  • extensive examples – series of use cases shown in dedicated Visual Studio solutions (available in the package) and a lot of useful information on the author’s blog
  • it’s not free tool, but probably is worth its money; also evaluation version is available

C# Mail a.k.a. HiguchiMail

  • available at CodePlex, for free
  • no problems with fetching email with attachment; both email text and attachment easy to retrieve
  • comment in source code is written by Japanese icon smile Comparison of .Net libraries for fetching emails via POP3
  • even if there’s a problem there are lots of posts on discussion forum

To recap…

In my opinion Mail.dll and C# Mail are the winners in this competition. Perhaps the former is more advanced, better documented, and even easier to use. It might fit better for commercial / more advanced use. However for basic actions with POP3 you can save a few Euro and go for free C# Mail.

5 Responses to “Comparison of .Net libraries for fetching emails via POP3”


  • Hi Jaroslaw.

    I just discovered your comparison of POP3 libraries in .NET and was a bit disappointed.

    I recently took over the OpenPOP.NET project from the authors of it to develop it further.
    Since not too many people are commenting on the design or functionality of the project, I might ask you, since you have made a comparison of other .NET libraries in the same category.

    You are writing that you were unable to get any of your email’s attachment, and this sounds like a large but to me. Is it possible that you could tell me further about this, so that I can solve them problem?

    I might also ask you, how easy you felt it was to use? Maybe you have some comments on this? Be as harsh as you want – the program has to be easy to use.

    I hope you have a little time to spare to help develop the project further by stating you opinion.

    Regards
    foens

  • Just to clarify a point, C#Mail is licensed under the GPL, which makes it very unfriendly to distribution within commercial software. The author has said that he would take (US)$1000 for a commercial license, although for half that amount you could purchase a very good, commercially supported, POP3 library.
    I just recently changed from C#Mail (because of the GPL issue) to a development build of OpenPOP.NET and have been very happy with the results.

  • @John, GPL – thanks for pointing that out. Of course that is a big disadvantage if the library needs to be used in commercial product. In fact, this is a great barrier in such case.

    @John, @foens,
    Please bear in mind I don’t have the code I was playing with OpenPOP.Net so I’m describing only what I remember…
    There were two major problems I was having:
    1) As far as I know there was nothing like a Body property of a fetched email. The actual text could be retrieved, but it was available in mail object as an attachment.
    2) At the same time, the actual attachment was not accessible at all (I used debugger to browse anything email object contained)

    I’m not saying OpenPOP.Net is bad, don’t get me wrong :) First of all, I don’t know, maybe the problem was with the mail server I was using – it was sending a message with an unusual way. On the contrary, C# Mail or Mail.dll did not have those problems.

    Also, what I liked especially about Mail.dll is the vast majority of the examples available at its author blog. If you got stuck, you must find the answer there. But, they get money for their product, so presumably have more motivation to maintain such help resources :)

  • Hello again Jaroslaw.

    I have released a new version of the OpenPop.NET library just recently.

    The body part of the email is now much easier to get. If you want the text/plain part of the body, there is a dedicated method for that. You can also ask for any other MediaType using another method. This also applies to attachments. You can also create your own custom searching in the body if you want.

    Examples has also been created. I hope I can get more of them out, but right now there are some examples which should help most users get started. See OpenPop.NET’s example page for that.

    I am sure, that if you tried it again, your goals will be much easier to get to.

  • Hi Jarosław,

    Thanks for nice comparison.

    Just wanted to drop a line saying that Mail.dll, IMAP and POP3 component, has new home:
    http://www.limilabs.com/mail

Leave a Reply