SmtpServer
SmtpServer copied to clipboard
System.IO.IOException: Authentication failed because the remote party has closed the transport stream
Hello, Of late I am getting above mentioned error intermittently. I thought this could be the TLS version mismatch issue so I tried
SmtpServerOptionsBuilder options = new SmtpServerOptionsBuilder();
options.ServerName("Smtp Server")
.MessageStore(new EmailHandler2())// Register EmailStore
.MailboxFilter(new GatewayFilter())
.SupportedSslProtocols(SslProtocols.Tls |
SslProtocols.Tls11 |
SslProtocols.Tls12)
As you can see above, I added all the supported TLS versions but no success. Following is the detailed error:
System.IO.IOException: Authentication failed because the remote party has closed the transport stream. at System.Net.Security.SslStream.StartReadFrame(Byte[] buffer, Int32 readBytes, AsyncProtocolRequest asyncRequest) at System.Net.Security.SslStream.PartialFrameCallback(AsyncProtocolRequest asyncRequest) --- End of stack trace from previous location where exception was thrown --- at System.Net.Security.SslStream.EndProcessAuthentication(IAsyncResult result) at System.Threading.Tasks.TaskFactory1.FromAsyncCoreLogic(IAsyncResult iar, Func
2 endFunction, Action1 endAction, Task
1 promise, Boolean requiresSynchronization) --- End of stack trace from previous location where exception was thrown --- at SmtpServer.IO.NetworkClient.UpgradeAsync(X509Certificate2 certificate, SslProtocols protocols, CancellationToken cancellationToken) in /src/SmtpServer/IO/NetworkClient.cs:line 132 at SmtpServer.Protocol.StartTlsCommand.ExecuteAsync(SmtpSessionContext context, CancellationToken cancellationToken) in /src/SmtpServer/Protocol/StartTlsCommand.cs:line 30 at SmtpServer.SmtpSession.ExecuteAsync(SmtpSessionContext context, CancellationToken cancellationToken) in /src/SmtpServer/SmtpSession.cs:line 96 at SmtpServer.SmtpSession.RunAsync(CancellationToken cancellationToken) in /src/SmtpServer/SmtpSession.cs:line 71 --- End of inner exception stack trace ---
@cosullivan Can you please suggest what may be going wrong here?