tags:

views:

1432

answers:

6

I have a project that utilizes the javax.mail.internet.MimeMessage and other related classes that does mime parsing for emails that we receive. This needs to be ported to .NET.

What .Net 3rd party or built in library can I use to replace the Java classes that I'm using?

EDIT: Anything change in the last 9 months since I asked this question?

+4  A: 

I've not used javax.mail.internet.MimeMessage, so I can't say how any of this compares, but .NET 2.0 and beyond does have a System.Net.Mime namespace which might have something useful for you.

Otherwise, I used Chilkat MIME .NET a long time ago and was happy with it.

Ryan Farley
+2  A: 

I have used both, and concur with Ryan that the System.Net.Mime and sibling namespaces provide very similar functionality. If anything, I think you'll find that the .Net APIs are cleaner and easier to work with.

jsight
+3  A: 

SharpMimeTools, which is free and open source.

http://anmar.eu.org/projects/sharpmimetools/

It's what I use in my application, BugTracker.NET and it has been very dependable.

Corey Trager
SharpMimeTools is a great library
Sergej Andrejev
A: 

You may try a S/MIME library included in our Rebex Secure Mail component.

Features include:

  • high level API (MailMessage - as seen in email client)
  • low level API (access to a MIME tree)
  • autocorrecting code for mangled messages and for messages produced by misbehaving email clients
  • ability to read TNEF (aka winmail.dat created by Outlook)
  • S/MIME: sign/encrypt/decrypt messages
  • supports both .NET and .NET CF

Check features, MailMessage tutorial and S/MIME tutorial. You can download it at www.rebex.net/secure-mail.net

Martin Vobr
+1  A: 

I am in need of such a library, too. Looking for a mime processing library. I need to convert messages and attachments to PDF.
Here are some of the libraries I have found so far. Open Source Libraries:

Commercial Libraries:

  • Mime4Net
  • Rebex
  • Chilkat
  • Aspose - the most expensive option that I see.

(would have added more links, but my account level prevents me from doing so)

I am still sorting through these, and have not tried one yet. Probably gonna start with SharpMime since it's open source. Mime4Net has some examples on their site. From what I see, none of these offer the the conversion to PDF that I am needing, but there are other libraries I am looking at to fulfill that task.

Marty
A: 

Try using Mail.dll IMAP component, it's on the market for quite a while, and is well tested.

using(Imap imap = new Imap())
{
    imap.Connect("imapServer");
    imap.Login("user", "password");

    imap.SelectInbox();
    List<long> uids = imap.SearchFlag(Flag.Unseen);

    foreach (long uid in uids)
    {
        string eml = imap.GetMessageByUID(uid);
        IMail message = new MailBuilder()
            .CreateFromEml(eml);

        Console.WriteLine(message.Subject);
    }
    imap.Close(true);
}

Please note that Mail.dll is a commercial product that I've created.

You can download it here: http://www.lesnikowski.com/mail.

Pawel Lesnikowski