is there a complete sample?

Jul 7, 2012 at 11:57 AM
Edited Jul 7, 2012 at 12:32 PM

First, thank you for your effort in developing this library :)

Second, your library seems nice and easy, but when I start to use it stops working at calling


and after a long time, it throws an exception at the same line with the following inner exception:

Unable to evaluate expression because the code is optimized or a native frame is on top of the call stack.

And here is my full code...

private const string IMAP_SERVER = "";
private const int IMAP_PORT = 993;

private const string USER_NAME = "";
private const string PASSWORD = "1234567";

private ImapClient _client;


_client = new ImapClient();

_client.Security = SecurityPolicies.Explicit;
_client.Connect(IMAP_SERVER, IMAP_PORT);
_client.Authenticate(USER_NAME, PASSWORD);

_client.StatusUpdateReceived += new EventHandler<StatusUpdateReceivedEventArgs>(_client_StatusUpdateReceived);

var query = _client.Messages.Where(m => m.Flags.HasFlag(MessageFlags.Answered)).Select(x => x.Envelope);
StringBuilder str = new StringBuilder();
foreach (var msg in query)

So, What is the problem?


Also, would you mind creating a full sample for using your code?

Thanks in advance

Jul 8, 2012 at 7:25 PM


on first glance your code seems fine, due to the time delay it seems like a timeout exception.

Have you made sure a connection has been successfully established ?

You can trace all communication with the server by using Debug assemblies, it all gets outputted to the Debug console.