I perform this operation every second (I’m using an evaluation 5.7.0) and get exception {“AE0004 NO Select Command is not permitted in current state (NotAuthenticatedServerError)”}
{
// Create a new IMAP client, connect, and log in
using (var client = new ImapClient(“imap-mail.outlook.com”, 993,
“McFaddinAlpineTest@hotmail.com”, “AlpineTest”))
{
if (connectionInfo.RequireSsl)
{
client.SecurityOptions = SecurityOptions.SSLImplicit;
}
try
{
client.SelectFolder(“Inbox”);
// Check to see if there are any new messages waiting
var inbox = client.GetFolderInfo(“Inbox”);
var newMessageCount = inbox.NewMessageCount;
if (newMessageCount > 0)
{
}
}
catch (Exception e)
{
log.Error(“Exception occured with IMAP server”, e);
}
}
}
I took out the code that processes the message since you need not receive any new emails. Sometimes it takes longer that 1 sec to connect so it would be more correct to say, 1 sec after the last connection another connection is attempted.