Aspose.Email IMAPClient => ValidateCredential failed when deploy on iis server on premise environment

Hello Team,

In my company we are facing an issue about ValidateCredentials using ImapClient when we deploy our solution on iis server on premise environment… We use a paid license

When using localhost, no issue, ValidateCredentials works well
But on the server, we receive this error :

ImapException: Unable connect to the server.
at Ue.Ue1f6b(IAsyncResult a)
at Ue.Ue1f6u()
at xQ.wf1f6a(Ve a)
at yf.a(Int32 a, Ve b, List1 c, Int32 d)
at yf.b(Int32 a, Ve b, wf c, List1 d)
at yf.yf1f6a(Int32 a, Ve b)
at yf.f.MoveNext()
— End of stack trace from previous location —
at yf.e.MoveNext()
— End of stack trace from previous location —
at Aspose.Email.Clients.Imap.ImapClient.Uy.MoveNext()
— End of stack trace from previous location —
at Iristia.Aspose.AsposeClientService.TryValidateCredentialsAsync(String host, Int32 port, String username, String password, Boolean useSsl) in
C:\deploy\Iristia\Iristia.Shared\Iristia.Core\Aspose\AsposeClientService.cs:line 60

And this error is not understandable for us…
As security, the admin server close some port, but what do you use to test the imap credential ? TCP Client ?

Thanks a lot

Hi @JEREMY_JANIS,

We’re sorry about the inconvenience you’re facing. To clarify the issue, we need to know: Is the problem only with ValidateCredentials method? Are there any problems calling other IMAP client methods (e.g. SelectFolder, ListMessages)? Can you please also share a code example where you use ImapClient?

Thank you.

Hi @margarita.samodurova,

after many attempts, I couldn’t get it to work.

I create a test for this. If I deploy it into Azure server, all things works.
But if I deploy it on the IIS server used by my company (it’s an OVH server), nothing works

Aspose.Iis.Tests.zip (7,1 Mo)

When deployed on azure we can see that things work :

Aspose On Azure

But on IIS :

Aspose On IIS

Nothing works

Maybe it’s a bad configuration on OVH IIS Server, but even the admin doesn’t know.

What is the method you use to send message to IMAP and retrieve the response ? TcpClient ? WebSockets?

What are the ports you use ?

Thanks for help

Hi @JEREMY_JANIS
To connect Aspose.Email uses the class Socket from the System.Net.Sockets namespace. Typically, an IMAP client uses ports 993(SSL/TLS) and 143(non secure), this depends on your mail server. The ‘Unable connect to the server’ error indicates that the client does not have a connection to the mail server, perhaps the necessary ports are closed? If the application runs on Azure, then the client is working correctly, I’m afraid we won’t be able to help with setting up your specific IIS.

Hello Alexander, I’m working with Jeremy on this project and there are a few missing information about the Aspose.Email behaviour.
Actually sometimes it works perfectly (I have created a brand new e-mail address on outlook and it works).
All the required ports are unabled on the server. So do you have any idea or advice to help us to solve this issue?

Hello @Gaetan_J,

We’re happy to know that Aspose.Email is successfully helping you with your work.

Please kindly let us know what information you need to know about Aspose.Email’s behavior.

The “Unable to connect to the server” error indicates that there may be an issue with the server configuration or network connectivity.

Here are some of our ideas that may help:

  • Check network and firewall settings, ensure that the OVH has the necessary outbound internet connectivity to reach the IMAP server. Check if there are any firewall rules that might be blocking outgoing IMAP connections from the server.
  • Confirm that the IMAP server and port you are trying to connect to is correct. Double-check the server address and port number.
  • Check if there are any specific settings or restrictions imposed by OVH that might affect outbound network connections.
  • Check the server logs on the OVH server for any relevant error messages or info.
  • Consider reaching out to OVH’s support team. Also, OVH may have specific docs that can help with server-related problems.

Keep us informed about the results.
Thank you.