Skip to content

Instantly share code, notes, and snippets.

@jstedfast
Created March 14, 2015 13:54
Show Gist options
  • Save jstedfast/95c508ad897765d30ff6 to your computer and use it in GitHub Desktop.
Save jstedfast/95c508ad897765d30ff6 to your computer and use it in GitHub Desktop.
using (var client = new ImapClient ()) {
var inbox = client.Inbox;
client.Connect(_currEmailAccountInfoAcct.Servername, 993, true, _emailCancellationTokenSource.Token);
inbox.Open(FolderAccess.ReadOnly); // this throws NullReferenceException
client.AuthenticationMechanisms.Remove("XOAUTH2");
client.Authenticate(_currEmailAccountInfoAcct.UserName, _currEmailAccountInfoAcct.Password);
const MessageSummaryItems summaryItems = MessageSummaryItems.Envelope |
MessageSummaryItems.Flags | MessageSummaryItems.InternalDate |
MessageSummaryItems.MessageSize | MessageSummaryItems.BodyStructure;
var summaries = await inbox.Fetch(minIndex, maxIndex, summaryItems);
client.Disconnect(true);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment