使用C#,ASP.NET从Exchange读取电子邮件

问题描述:

我想从我的ASP.NET 3.5 Web应用程序中读取Exchange服务器的电子邮件。

我可以通过传递Exchange服务器名称来读取特定用户的邮箱中的电子邮件吗凭据?

您能否建议一些关于从ASP.NET中的Exchange服务器读取电子邮件的文章或代码示例?

感谢Ashok

Hi ,
    I want to read emails from Exchange server from my ASP.NET 3.5 web application.

Can i read emails from Mailbox of a particular user by passing Exchange server name and Credentials?

Can you suggest some articles or code samples about reading emails from Exchange server in ASP.NET?

Thanks
Ashok

假设您的目标是Exchange 2007(如果不是,则可能需要考虑使用 WebDAV ,但我无法帮助你):

通过EWS托管API ,您可以通过执行操作轻松阅读其他用户的邮箱以下内容:


Assuming you are targeting Exchange 2007 (if you are not, you may want to consider using WebDAV, but I can't help you much with it):

Using the Exchange Web Services via the EWS Managed API, you can read other users' mailboxes very easily, by doing the following:

ExchangeService service = new ExchangeService();
service.Credentials = new WebCredentials("username", "pwd");
service.AutodiscoverUrl("usertoaccess@contoso.com");

FindItemsResults<Item> findResults = service.FindItems(new FolderId(WellKnownFolderName.Inbox, "usertoaccess@contoso.com"), new ItemView(10));

foreach (Item item in findResults)
{
    // Do something with the item
}

>