Hi there,
When I’m trying to connect to a Exchange 2010 server via IMAP and port 143 I’m receiving this error:
002 BAD Command received in Invalid state.
When I try the same via port 993 and these settings:
imapClient.EnableSsl = true;
imapClient.SecurityMode = ImapSslSecurityMode.Implicit;
I’m getting these errors:
InnerException = {“The remote certificate is invalid according to the validation procedure.”}
Message = "Server cannot be authenticated"
When I’m trying only:
imapClient.SecurityMode = ImapSslSecurityMode.Implicit;
I’m getting this error:
Message = "Command failure."
What am I doing wrong? Via port 143 and Exchange 2000 everything was fine.
Best Regards
ImapClient client1 = new ImapClient(“[exchange.domain.com](http://exchange.domain.com/)”, 143, "user1@domain.com",“password”, SecurityOptions.Auto);
client1.SelectFolder(“Inbox”);
ImapMessageInfoCollection coll = client1.ListMessages();
ImapClient client2 = new ImapClient(“[exchange.domain.com](http://exchange.domain.com/)”, 993, "user1@aspose.com",“password”, SecurityOptions.SSLImplicit);
client2.SelectFolder(“Inbox”);
ImapMessageInfoCollection coll2 = client2.ListMessages();
Hello Kashif,
I’ve tried it with upgrading to Aspose.Email for .NET 6.6.0 (we are currently under 2.6.0) and using your same sample code. With the first sample (port 143) I’m getting:
AE0002 BAD Command received in Invalid state
With the second option (port 993) I’m getting:
Connection failure. Timeout ‘200000’ has been reached.
The firewall is open, that I checked already.
Best Regards,
Andreas
Hi Andreas,
Could you please try ignore or bypass the invalid or expired SSL certificate as shown in the following code sample and let us know if it is of any help to you in this regard.
Sample Code:
<pre class=“code-java” style=“padding: 0px; margin-top: 0px; margin-bottom: 0px; overflow: auto; font-family: “Courier New”, Courier, monospace; line-height: 1.3; color: rgb(51, 51, 51); font-size: 12.0333px; background-color: rgb(255, 255, 255);”>
// Register callback method for SSL validation event
ServicePointManager.ServerCertificateValidationCallback += RemoteCertificateValidationHandler;
// This event handler is called when SSL certificate is verified
private static bool RemoteCertificateValidationHandler(object sender, X509Certificate certificate, X509Chain chain, SslPolicyErrors sslPolicyErrors)
{
return true; //Ignore the checks and go ahead
}
Hi Kashif,
Thank you! Yes, with bypassing the SSL certificate the code works now.
Best Regards,
Andreas