Free Support Forum - aspose.com

Randomly get AE0004 exception

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.

Hi James,

Thank you for writing to Aspose Support team.

We have investigated this issue at our end by running the sample code, you provided, in a loop of 100 but could not reproduce the problem at our end. Everytime, the code executed successfully and didn’t raise any exception. Could you please share with us how often you get this error and if you are running this code in parallel for checking new messages? It may be helpful if you could provide the exact code sample to us for our investigation in case it is different from the one already provided above.