Hi Team,
I upgraded from Aspose.Email.dll 19.1 to Aspose.Email.dll 20.5. Now a customer of us cannot connect anymore with its provider via IMAP. The customer gets the following Exception:
Could not connect to IMAP: TimeoutException: The operation ‘Connect’ terminated. Timeout ‘100000’ has been reached.
at #=zOpjyArpTkbfVsmwxMZY57xINWeDr.#=zKlidF5E=(IAsyncResult #=zQJYoVKI=)
at #=zOpjyArpTkbfVsmwxMZY57xINWeDr.#=zAcr6BHc=()
at #=z6HQ9TNN2Gg4oqFtmIIi6lrTRxGT0.#=z1vcIXTa$wkC8(Int32 #=zuALJey8=, #=zKqoKWMxQNlrvqVZz2iMd519CUF1yjocakA== #=zsBWu8i4=)
at #=zOpjyArpTkbfVsmwxMZY57xINWeDr.#=zGJz9fitSEPc7()
at #=zOpjyArpTkbfVsmwxMZY57xINWeDr.#=zwIemAnA=(AsyncCallback #=zQM1JCBY=, Object #=zk$0tCEQ=)
at Aspose.Email.Clients.Imap.ImapClient.BeginGetFolderInfo(IConnection connection, String folderName, AsyncCallback callback, Object state)
at Aspose.Email.Clients.Imap.ImapClient.GetFolderInfo(String folderName)
at Com.Kendox.MailArchiver.Library.MailProviders.Imap.ImapMailProvider.Connect(MergedProfile profile, Boolean enableTrace, Action`2 callback)
Connection security: Auto selection mode
Code to connect to IMAP:
> public void Connect(MergedProfile profile, bool enableTrace, Action<bool, Exception> callback)
> {
> try
> {
> this.LogWriterPrefix = profile.MailBoxAddress;
>
> LogWriter.WriteMessage("Trying to connect to IMAP with HostName [" + profile.ImapHostName + "], MailBoxAddress [" + profile.MailBoxAddress + "], PortNumber [" + profile.ImapPortNumber + "], SecurityOption [" + profile.ImapSecurityOption + "]", this.LogWriterPrefix, LogLevels.Info, "", Constants.EventLogType.Connect);
>
> client = new ImapClient();
>
> client.Host = profile.ImapHostName;
> client.Username = profile.MailBoxAddress;
>
> string password = Encryption.ToInsecureString(profile.ImapMailBoxPassword);
> if (string.IsNullOrEmpty(password))
> {
> throw new ImapConnectionException("IMAP mailbox password is not set.");
> }
> client.Password = password;
>
> client.Port = profile.ImapPortNumber;
>
> // Security option
> if (profile.ImapSecurityOption == ImapSettings.ImapSecurityOptions.Auto)
> {
> client.SecurityOptions = SecurityOptions.Auto;
> }
> else if (profile.ImapSecurityOption == ImapSettings.ImapSecurityOptions.SSLExplicit)
> {
> client.SecurityOptions = SecurityOptions.SSLExplicit;
> }
> else if (profile.ImapSecurityOption == ImapSettings.ImapSecurityOptions.SSLImplicit)
> {
> client.SecurityOptions = SecurityOptions.SSLImplicit;
> }
> else if (profile.ImapSecurityOption == ImapSettings.ImapSecurityOptions.None)
> {
> client.SecurityOptions = SecurityOptions.None;
> }
>
> // Tests connection to IMAP server by getting folder info of the inbox.
> ImapFolderInfo folderInfo = client.GetFolderInfo(ImapFolderInfo.InBox);
>
> ConnectionState connectionState = client.ConnectionState;
> if (connectionState == ConnectionState.Open)
> {
> callback(true, null);
> }
> else
> {
> // TODO: Test, if connection status is not open.
> throw new ImapConnectionException("IMAP connection is closed or broken.");
> }
> }
> catch (Exception ex)
> {
> try
> {
> if (client != null)
> client.Dispose();
> }
> catch (Exception) { }
> if (client != null)
> client = null;
> callback(false, ex);
> }
> }
The above code works with Aspose.Email.fll Version 19.1, with Aspose.Email.dll Version 20.5 Aspose throws a TimeOutException. What could be the cause of the exception? Do I have to adapt the code?
P.S.: I upgraded Aspose.Email.dll to Version 20.5 in order to support TLS1.1, TLS1.2, TLS1.3.