Free Support Forum - aspose.com

Aspose.Email Imap Client gets stuck in an infinite loop

I am building a system which will connect to an email account, specified by the user, and download emails. The ImapClient class is getting stuck in an infinite loop when I attempt an SSL connection to an Exchange server where SSL is disabled.


When connecting with POP3, an IOException is thrown by the client which I can catch and handle, however the ImapClient catches and handles the exception itself and then appears to retry the connection indefinitely.

The following code sample is taken from the Aspose examples, I have added only

client.SelectFolder(ImapFolderInfo.InBox);

which is where the code enters the loop.

//Create an instance of the ImapClient class
ImapClient client = new ImapClient();

//Specify host, username and password for your client
client.Host = “exchange”;

// Set username
client.Username = “user@domain.local”;

// Set password
client.Password = “password”;

// Set the port to 993. This is the SSL port of IMAP server
client.Port = 993;

// Enable SSL
client.SecurityOptions = SecurityOptions.Auto;

try
{
client.SelectFolder(ImapFolderInfo.InBox);
//Disconnect to the remote IMAP server
client.Disconnect();
}

How should I handle this so that I can inform the user that the connection is invalid?

Thanks.

Hi,


Than you for contacting Aspose support team.

We have discussed this issue and observed that it is not a known issue. Could you please provide a temporary test account and its credentials on this exchange for further investigation? It will help us to re-produce the scenario and provide assistance accordingly.