集成POP3客户端功能集成到一个C#应用程序? [英] Integrating POP3 client functionality into a C# application?

查看:186
本文介绍了集成POP3客户端功能集成到一个C#应用程序?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我需要一个基于服务器的组件定期访问POP3电子邮件框和检索电子邮件,Web应用程序。然后,该服务需要处理电子邮件,其中将涉及:

  • 在对一些业务规则验证电子邮件(它包含在主题行中的有效参考,哪个用户发送邮件,等等。)
  • 分析和保存任何附件到磁盘
  • 以邮件正文和附件的详细信息,并在数据库中创建一个新的项目
  • 或更新现有项目,其中引用的接收电子邮件主题行匹配

什么是接近这一目标的最佳方式是什么?我真的不希望有从头开始编写一个POP3客户端,但我需要能够自定义邮件的处理。理想情况下我能插上一些组件,做访问和检索对我来说,返回的附件,正文,主题行,等准备好我的处理数组...

[更新:点评]

好了,所以我花了很多时间相当展望(主要是免费的).NET POP3库,所以我想我会提供一些​​下面所述的和其他一些简短评论:

  • <一个href="http://weblogs.shockbyte.com.ar/rodolfof/archive/2008/07/07/pop3.net-library.aspx">Pop3.net - 免费 - 工程确定,非常基本的中提供的功能方面。这是pretty的简单,只是在POP3命令和一些base64编码,但它是非常简单的 - 可能是一个很好的介绍
  • 的POP3向导 - 商业/一些开源$ C ​​$ C - 不能让这个建,丢失的DLL,我也不会用这个
  • 打扰
  • C#电子邮件 - 免费供个人使用 - 效果不错,自带MIME分析程序和SMTP客户端,但是评论是日语(没什么大不了的),并没有使用SSL'开箱即用' - 我不得不改变SslStream构造后,它的工作没有问题
  • OpenPOP - 免费 - 一直没有更新约5年,所以它的当前状态是.NET 1.0,没有按'科技支撑SSL但是这并没有解决的问题 - 我只是取代了现有流与SslStream和它的工作。配有哑剧分析器。

免费的图书馆,我会去的C#邮件或OpenPOP。

我看了一些商业库: Chillkat ,的 Rebex的的RemObjects ,<一个href="http://tech.dimac.net/default2.asp?M=Products/MenuDOTNET.asp&P=Products/JMaildotnet/start.htm">JMail.net.根据功能,价格和即时通讯$ P $公司pssion我可能会去Rebex的,并可能在未来,如果我的需求发生变化或者我遇到的生产问题,无论是C#的邮件或OpenPOP。

在任何情况下的需要它,这是我用来启用SSL用C#邮件和OpenPOP更换SslStream构造函数:

  SslStream流=新的SslStream(clientSocket.GetStream(),假的,
                 委托(对象发件人,X509证书证书,
                 X509Chain链,SslPolicyErrors错误){返回true; });
 

解决方案

我的 OpenPop.NET 。我只是摔倒了这一审查,并不得不拿出一些关于OpenPop.NET的当前状态的意见作为评审似乎已经过时的发展。

OpenPop.NET是回到积极发展。 SSL已经推出了半年回来。项目产生了重大的重构,现在更稳定和易于使用。当我接手这个项目它有一个很大的缺陷在里面,到现在为止我目前知道的没有。很多额外的功能已经实现,主要是在MIME分析程序的一部分。该项目是由单元测试的支持,每一次错误被发现,单元测试创​​建固定它之前显示此错误。一个伴随网站结合实例现在存在。此外,也有其他的更新,但我不想提他们。

此外,OpenPop.NET执照已经从 LGPL 到的Public域(又名,没有限制)。这个我觉得是为商业用户提供了重大改进。

I have a web application that requires a server based component to periodically access POP3 email boxes and retrieve emails. The service then needs to process the emails which will involve:

  • Validating the email against some business rules (does it contain a valid reference in the subject line, which user sent the mail, etc.)
  • Analysing and saving any attachments to disk
  • Take the email body and attachment details and create a new item in the database
  • Or update an existing item where the reference matches the incoming email subject line

What is the best way to approach this? I really don't want to have to write a POP3 client from scratch, but I need to be able to customize the processing of emails. Ideally I would be able to plug in some component that does the access and retrieval for me, returning arrays of attachments, body text, subject line, etc. ready for my processing...

[ UPDATE: Reviews ]

OK, so I have spent a fair amount of time looking into (mainly free) .NET POP3 libraries so I thought I'd provide a short review of some of those mentioned below and a few others:

  • Pop3.net - free - works OK, very basic in terms of functionality provided. This is pretty much just the POP3 commands and some base64 encoding, but it's very straight forward - probably a good introduction
  • Pop3 Wizard - commercial / some open source code - couldn't get this to build, missing DLLs, I wouldn't bother with this
  • C#Mail - free for personal use - works well, comes with Mime parser and SMTP client, however the comments are in Japanese (not a big deal) and it didn't work with SSL 'out of the box' - I had to change the SslStream constructor after which it worked no problem
  • OpenPOP - free - hasn't been updated for about 5 years so it's current state is .NET 1.0, doesn't support SSL but that was no problem to resolve - I just replaced the existing stream with an SslStream and it worked. Comes with Mime parser.

Of the free libraries, I'd go for C#Mail or OpenPOP.

I looked at a few commercial libraries: Chillkat, Rebex, RemObjects, JMail.net. Based on features, price and impression of the company I would probably go for Rebex and may in the future if my requirements change or I run into production issues with either of C#Mail or OpenPOP.

In case anyone's needs it, this is the replacement SslStream constructor that I used to enable SSL with C#Mail and OpenPOP:

SslStream stream = new SslStream(clientSocket.GetStream(), false,
                 delegate(object sender, X509Certificate cert,
                 X509Chain chain, SslPolicyErrors errors) { return true; });

解决方案

I am one of the main developers of OpenPop.NET. I just fell over this review, and had to come with some comments regarding the current state of OpenPop.NET as the review seems outdated with the development.

OpenPop.NET is back into active development. SSL has been introduced a half year back. The project had a major refactoring and is now much more stable and easy to use. When I took over the project it had a lot of bugs in it, and as of now I currently know none. A lot of extra features have been implemented, mainly in the MIME parser part. The project is backed by unit tests, and each time a bug is found, a unit test is created to show this bug before fixing it. An accompanying website with examples now exists. There has also been other updates, but I do not want to mention them all.

Also, OpenPop.NET's license has been changed from LGPL to Public Domain (aka, no restrictions). This I think is a major improvement for commercial users.

这篇关于集成POP3客户端功能集成到一个C#应用程序?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆