问题
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?
回答1:
I've recently released MimeKit which is far more robust than any of the other open source .NET MIME parser libraries out there and it's orders of magnitude faster as well due to the fact that it is an actual stream parser and not a recursive descent string parser (which also has the added benefit of it using a LOT less memory).
It has full support for S/MIME v3.2 (including compression, which none of the other libraries that claim "full" support actually support) and OpenPGP.
For SMTP, POP3, and IMAP you can use my MailKit library which supports a bunch of SASL authentication mechanisms including XOAUTH2 (used by Google). The SMTP client supports PIPELINING which can improve performance of sending mail and the IMAP client supports a growing number of extensions that allow clients to optimize their bandwidth as well.
回答2:
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.
回答3:
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.
回答4:
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.
回答5:
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:
- SharpMime.NET
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.
回答6:
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
回答7:
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.UseBestLogin("user", "password");
imap.SelectInbox();
List<long> uids = imap.SearchFlag(Flag.Unseen);
foreach (long uid in uids)
{
byte[] eml = imap.GetMessageByUID(uid);
IMail message = new MailBuilder()
.CreateFromEml(eml);
Console.WriteLine(message.Subject);
}
imap.Close();
}
Please note that Mail.dll is a commercial product that I've created.
You can download it here: http://www.limilabs.com/mail.
来源:https://stackoverflow.com/questions/19096/what-net-mime-parsing-libraries-are-available