什么是.NET Mime Parsing库?

时间:2023-01-19 00:25:30

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.

我有一个项目利用javax.mail.internet.MimeMessage和其他相关的类,它们为我们收到的电子邮件进行mime解析。这需要移植到.NET。

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

我可以使用什么.Net第三方或内置库来替换我正在使用的Java类?

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

编辑:自从我问这个问题以来,过去9个月有什么变化吗?

7 个解决方案

#1


10  

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).

我最近发布了MimeKit,它比任何其他开源.NET MIME解析器库都强大得多,并且由于它是一个实际的流解析器而不是递归下降字符串,它的速度也快了几个数量级。解析器(使用少量内存也具有额外的好处)。

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.

它完全支持S / MIME v3.2(包括压缩,其他所有声称“完全”支持的库实际上都不支持)和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.

对于SMTP,POP3和IMAP,您可以使用我的MailKit库,它支持一系列SASL身份验证机制,包括XOAUTH2(由Google使用)。 SMTP客户端支持PIPELINING,可以提高发送邮件的性能,IMAP客户端支持越来越多的扩展,允许客户端优化其带宽。

#2


7  

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.

我没有使用javax.mail.internet.MimeMessage,所以我不能说这有什么比较,但.NET 2.0及更高版本确实有一个System.Net.Mime命名空间可能对你有用。

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

否则,我很久以前就使用过Chilkat MIME .NET而且很满意。

#3


6  

SharpMimeTools, which is free and open source.

SharpMimeTools,免费开源。

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

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

这是我在我的应用程序中使用的BugTracker.NET,它非常可靠。

#4


2  

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.

我使用过两者,并同意Ryan,System.Net.Mime和兄弟命名空间提供了非常相似的功能。如果有的话,我想你会发现.Net API更干净,更容易使用。

#5


2  

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:

我也需要这样的图书馆。寻找一个哑剧处理库。我需要将邮件和附件转换为PDF。这是我到目前为止找到的一些库。开源库:

Commercial Libraries:

  • Mime4Net
  • Rebex
  • Chilkat
  • Aspose - the most expensive option that I see.
  • Aspose - 我看到的最昂贵的选择。

(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.

我还在整理这些,还没有尝试过。可能会从SharpMime开始,因为它是开源的。 Mime4Net在他们的网站上有一些例子。从我看到的,这些都没有提供我需要的转换为PDF,但我正在寻找其他库来完成该任务。

#6


1  

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

您可以尝试我们的Rebex Secure Mail组件中包含的S / MIME库。

Features include:

  • high level API (MailMessage - as seen in email client)
  • 高级API(MailMessage - 如电子邮件客户端中所示)

  • low level API (access to a MIME tree)
  • 低级API(访问MIME树)

  • autocorrecting code for mangled messages and for messages produced by misbehaving email clients
  • 自动更正错误消息的代码和由行为不端的电子邮件客户端生成的消息

  • ability to read TNEF (aka winmail.dat created by Outlook)
  • 能够读取TNEF(也就是由Outlook创建的winmail.dat)

  • S/MIME: sign/encrypt/decrypt messages
  • S / MIME:签名/加密/解密消息

  • supports both .NET and .NET CF
  • 支持.NET和.NET CF.

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

检查功能,MailMessage教程和S / MIME教程。您可以在www.rebex.net/secure-mail.net下载

#7


0  

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

尝试使用Mail.dll IMAP组件,它已经上市了很长一段时间,并且经过了充分的测试。

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.

请注意,Mail.dll是我创建的商业产品。

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

你可以在这里下载:http://www.limilabs.com/mail。

#1


10  

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).

我最近发布了MimeKit,它比任何其他开源.NET MIME解析器库都强大得多,并且由于它是一个实际的流解析器而不是递归下降字符串,它的速度也快了几个数量级。解析器(使用少量内存也具有额外的好处)。

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.

它完全支持S / MIME v3.2(包括压缩,其他所有声称“完全”支持的库实际上都不支持)和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.

对于SMTP,POP3和IMAP,您可以使用我的MailKit库,它支持一系列SASL身份验证机制,包括XOAUTH2(由Google使用)。 SMTP客户端支持PIPELINING,可以提高发送邮件的性能,IMAP客户端支持越来越多的扩展,允许客户端优化其带宽。

#2


7  

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.

我没有使用javax.mail.internet.MimeMessage,所以我不能说这有什么比较,但.NET 2.0及更高版本确实有一个System.Net.Mime命名空间可能对你有用。

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

否则,我很久以前就使用过Chilkat MIME .NET而且很满意。

#3


6  

SharpMimeTools, which is free and open source.

SharpMimeTools,免费开源。

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

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

这是我在我的应用程序中使用的BugTracker.NET,它非常可靠。

#4


2  

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.

我使用过两者,并同意Ryan,System.Net.Mime和兄弟命名空间提供了非常相似的功能。如果有的话,我想你会发现.Net API更干净,更容易使用。

#5


2  

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:

我也需要这样的图书馆。寻找一个哑剧处理库。我需要将邮件和附件转换为PDF。这是我到目前为止找到的一些库。开源库:

Commercial Libraries:

  • Mime4Net
  • Rebex
  • Chilkat
  • Aspose - the most expensive option that I see.
  • Aspose - 我看到的最昂贵的选择。

(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.

我还在整理这些,还没有尝试过。可能会从SharpMime开始,因为它是开源的。 Mime4Net在他们的网站上有一些例子。从我看到的,这些都没有提供我需要的转换为PDF,但我正在寻找其他库来完成该任务。

#6


1  

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

您可以尝试我们的Rebex Secure Mail组件中包含的S / MIME库。

Features include:

  • high level API (MailMessage - as seen in email client)
  • 高级API(MailMessage - 如电子邮件客户端中所示)

  • low level API (access to a MIME tree)
  • 低级API(访问MIME树)

  • autocorrecting code for mangled messages and for messages produced by misbehaving email clients
  • 自动更正错误消息的代码和由行为不端的电子邮件客户端生成的消息

  • ability to read TNEF (aka winmail.dat created by Outlook)
  • 能够读取TNEF(也就是由Outlook创建的winmail.dat)

  • S/MIME: sign/encrypt/decrypt messages
  • S / MIME:签名/加密/解密消息

  • supports both .NET and .NET CF
  • 支持.NET和.NET CF.

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

检查功能,MailMessage教程和S / MIME教程。您可以在www.rebex.net/secure-mail.net下载

#7


0  

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

尝试使用Mail.dll IMAP组件,它已经上市了很长一段时间,并且经过了充分的测试。

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.

请注意,Mail.dll是我创建的商业产品。

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

你可以在这里下载:http://www.limilabs.com/mail。