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. I initially thought this must be开发者_JAVA百科 easy but I cannot find any simple tutorials or samples.
Can anyone help?
Check HERE: something similar already discussed. Mainly, you can use :
- Exchange Web Services Managed API
- IMAP
- POP3
If you will use EWS here is some sample :
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 );
}
精彩评论