I work with JavaMail a decent amount, and I've taken the time to Google up IMAP libs for Visual Basic.NET and/or C# (it's all the same stuff, of course) a number of times over the last year, and each time, the most thorough set of recommendations always seems to be from this thread over at stackflow.com.

The problem is that all of those solutions ultimately have some issue. Either they're fairly expensive, don't have many reviews, and/or, in the case of MailSystem.NET, the code is so poorly maintained and supported (there are at least two messages from the last month, iirc, in the Issues forum about Samples not working right now that haven't even been assigned) that it's ultimately a no-go. It appears to have worked fairly well in VS 2005, but has a few issues even at compilation now. To rebuild, the REQUIREMENTS.txt file tells you, you need...

The following tools are required to build the project:

- Visual Studio 2008
- Windows Mobile 5.0 Smartphone SDK - http://www.microsoft.com/downloads/details.aspx?familyid=dc6c00cb-738a-4b97-8910-5cd29ab5f8d9
- Windows SDK for Windows Server 2008 and .NET Framework 3.5 - http://www.microsoft.com/downloads/details.aspx?FamilyID=e6e1c3df-a74f-4207-8586-711ebe331cdc&displaylang=en
- Sandcastle - http://www.codeplex.com/Sandcastle
- Sandcastle Help File Builder - http://shfb.codeplex.com/


That's just a few more dependencies than the law will allow. (Croon on.)

MailBee's IMAP-only offerings at $199 looks the most promising from the paid crowd. Getting POP3, SMTP, etc too runs $399. The documentation, forum support, website, the whole bit looks pretty professional. And SMTP isn't a difficult protocol to roll yourself. I've done it before telnetting and via straight sockets. And, honestly, a well-developed, documented, and maintained library that does all this for $199 isn't a bad price at all.

But the real [apparent] winner isn't from the list or from MailBee. After giving up for now on finding the perfect IMAP package, I figured it would be smarter to write everything but the IMAP of an app I'm working on, building around a good MIME parser and just using some old Thunderbird mailboxes for testing messages, as I'd seen several open source, MPL or LGPL MIME libs. This time looking, I came across a post titled "Advanced MIME Parser/Creator/Editor" at CodeProject.com by Ivar Lumi, who, five years after posting it, still answers questions about his code in the comments to the posting, and answers them quickly. Turns out this MIME parser from 2005 is still in development, and just happens to now also include a full set of email protocols. The license is, at worst, LGPL. Jackpot.

The whole slew of libraries can be found here:
http://www.lumisoft.ee/lswww/download/downloads/Net/

The download comes with source. It compiles in VC# Express 2010 without a hitch. The IMAP client in its samples collection works when you hit F5.

Crazy.

There are some rough edges -- or, more accurately, it doesn't parse rough edges well at all. In at least two (1, 2) cases on the libs' forums, the lib author pretty much says, "Yeah, well, if your message doesn't follow the MIME protocol for email to a T, the lib's not going to parse it. Not my fault. I don't really care if Outlook does parse it. Blame the message." But honestly, who cares? You can still get the original message's stream from these libs and parse it yourself. And if you can't parse a text file, well, there are other professions than being a coder.

Why the guy's giving his work away under LGPL (or less) and supporting the libs like he does, I've no idea. He hasn't updated the front of his website since, going by the (c), 2006. /shrug It's not like he's drumming up business.

But it's really good stuff. Full source is good. And, get this, it works. Crazy.

Labels: , , ,