阅读在C#中的MS Exchange电子邮件 [英] Read MS Exchange email in C#

查看:200
本文介绍了阅读在C#中的MS Exchange电子邮件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我需要监视和从MS Exchange Server上的特定的邮箱(内部到我公司)阅读电子邮件的能力。我还需要能够读取发件人的电子邮件地址,主题,邮件正文和如有下载附件。

I need the ability to monitor for and read email from a particular mailbox on a MS Exchange Server (internal to my company). I also need to be able to read the sender's email address, subject, message body and download an attachment if any.

什么是做到这一点使用C#(或Vb.net)的最好方法?

What is the best way to do this using C# (or Vb.net)?

推荐答案

这是一个烂摊子。通过.NET互操作程序DLL MAPI或CDO是<一个href=\"http://blogs.msdn.com/mstehle/archive/2007/10/03/fyi-why-are-mapi-and-cdo-1-21-not-supported-in-managed-net-$c$c.aspx\">officially微软不支持的--IT会出现很好地工作,但也有由于其不同的内存模型问题内存泄漏。你可以使用CDOEX,但是这只能在Exchange服务器本身,而不是在远程;无用。你可以与Outlook互操作,但是现在,你只是做了Outlook的依赖;矫枉过正。最后,你可以使用 Exchange 2003中的WebDAV支持,但WebDAV是复杂的,.NET差已经建它-in支持,并(向雪上加霜)Exchange 2007中的几乎完全降到的WebDAV支持。

It's a mess. MAPI or CDO via a .NET interop DLL is officially unsupported by Microsoft--it will appear to work fine, but there are problems with memory leaks due to their differing memory models. You could use CDOEX, but that only works on the Exchange server itself, not remotely; useless. You could interop with Outlook, but now you've just made a dependency on Outlook; overkill. Finally, you could use Exchange 2003's WebDAV support, but WebDAV is complicated, .NET has poor built-in support for it, and (to add insult to injury) Exchange 2007 nearly completely drops WebDAV support.

什么是一个人做的?我结束了使用 AfterLogic的IMAP组件以通过IMAP我Exchange 2003服务器进行通信,这结束了工作很好。 (我通常寻找免费或开放源码库,但我发现所有想在.NET的人 - 尤其是当它涉及到一些2003的IMAP实施怪癖 - 这一次是足够便宜,并在第一个工作试试。我知道有其他人在那里。)

What's a guy to do? I ended up using AfterLogic's IMAP component to communicate with my Exchange 2003 server via IMAP, and this ended up working very well. (I normally seek out free or open-source libraries, but I found all of the .NET ones wanting--especially when it comes to some of the quirks of 2003's IMAP implementation--and this one was cheap enough and worked on the first try. I know there are others out there.)

如果您的组织是在Exchange 2007,但是,你很幸运。 Exchange 2007中附带了一个基于SOAP的Web服务接口终于提供了一个统一的,与语言无关与Exchange服务器的交互方式。如果你可以让2007+的要求,这肯定是要走的路。 (可悲的是我,我的公司拥有的,但2003不破的政策。)

If your organization is on Exchange 2007, however, you're in luck. Exchange 2007 comes with a SOAP-based Web service interface that finally provides a unified, language-independent way of interacting with the Exchange server. If you can make 2007+ a requirement, this is definitely the way to go. (Sadly for me, my company has a "but 2003 isn't broken" policy.)

如果您需要桥接两个Exchange 2003和2007,IMAP或POP3肯定是要走的路。

If you need to bridge both Exchange 2003 and 2007, IMAP or POP3 is definitely the way to go.

这篇关于阅读在C#中的MS Exchange电子邮件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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