Highlighted
Frequent contributor

Incoming email error

Jump to solution

I'm testing in our development environment and noticed an error in the EmailParser_Error.log that I haven't had success resolving.  I don't think it's App Portal since nothing has changed on the server when the error began but I'm wondering if anyone has run into this.  Outgoing email works fine, incoming email gets the error.

Unexpected error while connecting to imap server :  The operation is not allowed on non-connected sockets.  at System.Net.Sockets.NetworkStream.InitNetworkStream(Socket socket, FileAccess Access)
at System.Net.Sockets.NetworkStream..ctor(Socket socket, Boolean ownsSocket)
at MailKit.Net.Imap.ImapClient.<ConnectAsync>d__89.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at MailKit.Net.Imap.ImapClient.Connect(String host, Int32 port, SecureSocketOptions options, CancellationToken cancellationToken)
at MailKit.MailService.Connect(String host, Int32 port, Boolean useSsl, CancellationToken cancellationToken)
at AppPortal.Infrastructure.Services.MailParserService.ConnectToIMAPServer(MailParserConfiguration configuration, String& errormessage)
 

Unexpected error while connecting to imap server : An error occurred while attempting to establish an SSL or TLS connection.

One possibility is that you are trying to connect to a port which does not support SSL/TLS.

The other possibility is that the SSL certificate presented by the server is not trusted by the system for one or more of the following reasons:
1. The server is using a self-signed certificate which cannot be verified.
2. The local system is missing a Root or Intermediate certificate needed to verify the server's certificate.
3. The certificate presented by the server is expired or invalid.

See https://github.com/jstedfast/MailKit/blob/master/FAQ.md#InvalidSslCertificate for possible solutions. Unable to read data from the transport connection: An existing connection was forcibly closed by the remote host. at MailKit.Net.Imap.ImapClient.<ConnectAsync>d__89.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at MailKit.Net.Imap.ImapClient.Connect(String host, Int32 port, SecureSocketOptions options, CancellationToken cancellationToken)
at MailKit.MailService.Connect(String host, Int32 port, Boolean useSsl, CancellationToken cancellationToken)
at AppPortal.Infrastructure.Services.MailParserService.ConnectToIMAPServer(MailParserConfiguration configuration, String& errormessage)

0 Kudos
1 Solution

Accepted Solutions
Highlighted
Frequent contributor

Re: Incoming email error

Jump to solution
The issue was related to a server migration recently completed. Our firewall team had to make a fix for SSL

View solution in original post

6 Replies
Highlighted
Flexera
Flexera

Re: Incoming email error

Jump to solution
As you mention, it sounds as if App portal is trying to use https, where the server only supports http, or vice versa.. What port do you have specified under the incoming tab? If 993, then be sure that "use SSL to connect to Mail Server" is selected.
0 Kudos
Highlighted
Moderator Moderator
Moderator

Re: Incoming email error

Jump to solution

It is fairly common for SMTP/IMAP servers to require SSL for incoming mail and not require it for outbound mail.  Are your App Portal inbound and outbound settings different in that regard?  Is it possible the mail server configuration changed to require SSL where App Portal wasn't configured to use SSL?  Another possibility might be if the mail server configuration was (either intentionally or inadvertently by way of a recent Microsoft update) changed to require TLS 1.2 or higher.  In such a case, even if the App Portal configuration is set to use SSL, the server itself may not be configured to use TLS 1.2 for all communication.  If that's the case, check out this post.

Anything expressed here is my own view and not necessarily that of my employer, Flexera. If my reply answers a question you have raised, please click "ACCEPT AS SOLUTION".
Tags (3)
0 Kudos
Highlighted
Frequent contributor

Re: Incoming email error

Jump to solution
The issue was related to a server migration recently completed. Our firewall team had to make a fix for SSL

View solution in original post

Highlighted
Occasional contributor

Re: Incoming email error

Jump to solution
Hi,
I'm getting the same error message. Could you please provide more details about the actions taken by your firewall team!
0 Kudos