简体   繁体   English

C#从MS Exchange阅读电子邮件

[英]C# reading Emails from MS Exchange

Hi I am new to c# and have been asked to read in the title and contents of emails that arrive in a particular email account and them store them in SQL. 嗨,我是c#的新手,并被要求阅读到达特定电子邮件帐户的电子邮件的标题和内容,并将其存储在SQL中。 I initially thought this must be easy but I cannot find any simple tutorials or samples. 我最初以为这很容易,但是我找不到任何简单的教程或示例。

Can anyone help? 有人可以帮忙吗?

Check HERE : something similar already discussed. 这里检查:已经讨论过类似的内容。 Mainly, you can use : 主要可以使用:

If you will use EWS here is some sample : 如果您将使用EWS,请参考以下示例:

    ExchangeService service = new ExchangeService(ExchangeVersion.Exchange2007_SP1); // depends from Exchange server version 
    //service.Credentials = new NetworkCredential( "{Active Directory ID}", "{Password}", "{Domain Name}" );
    service.AutodiscoverUrl( "First.Last@MyCompany.com" );
    FindItemsResults<Item> findResults = service.FindItems(WellKnownFolderName.Inbox,
          new ItemView( 10 ) );
    foreach ( Item item in findResults.Items )
    {
       Console.WriteLine( item.Subject );
    }

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM