This project is read-only.

is there a complete sample?

Jul 7, 2012 at 12:57 PM
Edited Jul 7, 2012 at 1: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

client.Select("INBOX");

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 = "imap.gmail.com";
private const int IMAP_PORT = 993;

private const string USER_NAME = "myMail@gmail.com";
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);

_client.Select("INBOX");
var query = _client.Messages.Where(m => m.Flags.HasFlag(MessageFlags.Answered)).Select(x => x.Envelope);
StringBuilder str = new StringBuilder();
foreach (var msg in query)
{
        str.AppendLine(msg.Subject);
}
MessageBox.Show(str.ToString());

So, What is the problem?

 

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

Thanks in advance

Jul 8, 2012 at 8:25 PM

Well, 

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.

Alexander