I'm trying to retrieve mailbox information by selecting the mailbox and then accessing the WorkingMailboxInfo. I've tried this with gmail and yahoo accounts and I noticed that ContainsNewMessages is always false, NewUnseenMessages and RecentMessages are always 0. First I tried just single calls and then I thought maybe the client has to be instantiated in order to detect changes in state. Still, even if new emails arrive while the loop is running the values are still unchanged.
I'd appreciate anny help.
Regards,
Ciprian
[code lang='c#']
var client = new ImapClient();
client.Connect("imap.gmail.com", 993, SecurityMode.Implicit);
client.Authenticate("xyz@gmail.com", "...");
var n = 0;
while (n < 20)
{
if (client.WorkingMailbox != null)
client.Deselect();
client.Select("INBOX");
Console.WriteLine(client.WorkingMailbox.ContainsNewMessages);
Console.WriteLine(client.WorkingMailbox.NewUnseenMessages);
Console.WriteLine(client.WorkingMailbox.RecentMessages);
n++;
Thread.Sleep(1000);
}
client.Disconnect();
[/code