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.
Can you please try setting TimeOut value to -1 and see if that works for you. If that still fail then we request you to please provide test account credentials that we may use on our end to reproduce and resolve the issue.
Can you please share test account credentials that we use to verify the same on our end. We tried to register using different browsers and unable to register there.
I have created an issue with ID EMAILNET-39884 in our issue tracking system to further investigate and resolve the issue. This thread has been linked with the issue so that you may be notified once the issue will be fixed.
Actually, the valid port number for non-secured connections is port:143. You have used port: 993 for both secured and non-secured connections. That’s the reason of your problem. Please try using following sample code.
I made the test with the non-secured connection and port 143 and got the following Aspose exception:
AE_1_1_0001 BAD expected end of data instead of “%Ta87_&5l”
—> AsposeException: AE_1_1_0001 BAD expected end of data instead of “%Ta87_&5l”
—> AsposeException: AE_1_1_0001 BAD expected end of data instead of “%Ta87_&5l”
—> ImapException: AE_1_1_0001 BAD expected end of data instead of “%Ta87_&5l”
at #=z7T0xpLhuzLWoQxFFLFAiPzZcn4$0l9ZGTbaWgf4=.#=z6zXK2mestUHh(ImapStatusCode #=zEo3f8ZrNX_N5)
at #=zZcjkCeYvIgeGygVEZmvdocskk8oNKaNRjgIJVWQ=.#=z6zXK2mestUHh()
at #=zjjWtojbLcAF8M26JLDUyX8GtjtpcixFOZyKSvNY=.#=zqpNK1i8=(Object #=z9VnlUFw=)
— End of inner exception stack trace —
at #=zCCQrHjm4_8t0gTJzxZbVlLI4PzT0.#=zm6m$OKs=(IAsyncResult #=z1lMPYe0=)
at #=zCCQrHjm4_8t0gTJzxZbVlLI4PzT0.#=zA7pbz20=()
at #=zJXWdgZoq0MXT341Gyyecm9k5J_AWMYOuHKUYx3A=.#=zAWC86LmJULIjRzngB77htvU=(String #=zkMRd$fM=, Int32 #=z_WazWhs=)
at #=zJXWdgZoq0MXT341Gyyecm9k5J_AWMYOuHKUYx3A=.#=zuPnCPiY4odjm(String #=zkMRd$fM=, Int32 #=z_WazWhs=)
— End of inner exception stack trace —
at #=zJXWdgZoq0MXT341Gyyecm9k5J_AWMYOuHKUYx3A=.#=zuPnCPiY4odjm(String #=zkMRd$fM=, Int32 #=z_WazWhs=)
at #=zJXWdgZoq0MXT341Gyyecm9k5J_AWMYOuHKUYx3A=.#=zBYAtS6E=()
at #=zRnWT52DnYFWSE_UgwrLvACT8AyiX1fogRw==.#=zDqe5LPfsLg$p()
— End of inner exception stack trace —
at #=zCCQrHjm4_8t0gTJzxZbVlLI4PzT0.#=zm6m$OKs=(IAsyncResult #=z1lMPYe0=)
at #=zCCQrHjm4_8t0gTJzxZbVlLI4PzT0.#=zA7pbz20=()
at #=zLpDCtR4lOfSpkFg4O4SNjHL9Bm9B.#=z8NnE4pt1SLsk(Int32 #=zLOTc$Uc=, #=zcMuZGXhTF0d42zBknWm1rTW6jT923syjRQ== #=zOeouHEw=)
at #=zCCQrHjm4_8t0gTJzxZbVlLI4PzT0.#=zj5IRYthcvK4D()
at #=zCCQrHjm4_8t0gTJzxZbVlLI4PzT0.#=zWL1GkYM=(AsyncCallback #=zbE3oAm0=, Object #=z9VnlUFw=)
at Aspose.Email.Clients.Imap.ImapClient.BeginGetFolderInfo(IConnection connection, String folderName, AsyncCallback callback, Object state)
at Aspose.Email.Clients.Imap.ImapClient.GetFolderInfo(String folderName)
What does this mean in plain English?
In my mail from July 25th I asked you two questions? Have you investigated point 2?
What security option you have set to obtain the exception. If I set security option as None, I get following error.
AE_1_1_0001 NO [PRIVACYREQUIRED] An error occurred accessing your GMX e-mails: Your connection is not secure. Please activate SSL in your mail program.
You have shared following two things in 25 July query. In 1, you shared credentials and in 2, you shared environment details.
Yes, with your second account credentials, I am able to reproduce the issue. A ticket with ID EMAILNET-39892 has been created to further investigate and resolve the issue. We will share the feedback with you as soon as the issue will be fixed.
I regret to share that at present the concerned issue is unresolved. We request for your patience and will share the good news with you as soon as the issue will be fixed.
Actually, usual passwords may contain special characters for the IMAP protocol, so it is important to escape it before. The server misinterpreted ‘%’ char in the password:
AE_1_1_0001 LOGIN mafferkalimo@gmx.de ************
AE_1_1_0001 BAD expected end of data instead of “%Ta****”
We can consider placing quotes around the password:
But escaping password not solve the connection issue. We need to use SecurityOptions.SSLExplicit or SecurityOptions.SSLAuto to login on port 143. In case of SecurityOptions.SSL* we don’t need to escape the password. I hope the shared information will be helpful.