Describe the bug
A clear and concise description of what the bug is.
Platform (please complete the following information):
OS: Windows
.NET Runtime: 8.0
.NET Framework: .Net Core
MimeKit Version: 4.3.0
To Reproduce
Steps to reproduce the behavior:
Configure an email server of smtprelay server.com Port 25.
Attempt to send an email
Get Error
Expected behavior
System.Net.Mail will send the error but MailKit won't.
Error
2024-04-08 16:18:02,462 [.NET TP Worker] ERROR CI.MessagingLibrary.Services.MailKitService - Failed to send e-mail: MailKit.Security.SslHandshakeException: An error occurred while attempting to establish an SSL or TLS connection.
When connecting to an SMTP service, port 25 is typically reserved for plain-text connections. If
you intended to connect to SMTP on the SSL port, try connecting to port 465 instead. Otherwise,
if you intended to use STARTTLS, make sure to use the following code:
---> System.Security.Authentication.AuthenticationException: Cannot determine the frame size or a corrupted frame was received.
at System.Net.Security.SslStream.GetFrameSize(ReadOnlySpan1 buffer) at System.Net.Security.SslStream.EnsureFullTlsFrameAsync[TIOAdapter](CancellationToken cancellationToken, Int32 estimatedSize) at System.Runtime.CompilerServices.PoolingAsyncValueTaskMethodBuilder1.StateMachineBox`1.System.Threading.Tasks.Sources.IValueTaskSource.GetResult(Int16 token)
at System.Net.Security.SslStream.ReceiveHandshakeFrameAsync[TIOAdapter](CancellationToken cancellationToken)
at System.Net.Security.SslStream.ForceAuthenticationAsync[TIOAdapter](Boolean receiveFirst, Byte[] reAuthenticationData, CancellationToken cancellationToken)
at System.Net.Security.SslStream.AuthenticateAsClient(SslClientAuthenticationOptions sslClientAuthenticationOptions)
at MailKit.Net.Smtp.SmtpClient.Connect(String host, Int32 port, SecureSocketOptions options, CancellationToken cancellationToken)
--- End of inner exception stack trace ---
at MailKit.Net.Smtp.SmtpClient.Connect(String host, Int32 port, SecureSocketOptions options, CancellationToken cancellationToken)
Describe the bug A clear and concise description of what the bug is.
Platform (please complete the following information):
To Reproduce Steps to reproduce the behavior:
Expected behavior System.Net.Mail will send the error but MailKit won't.
Error 2024-04-08 16:18:02,462 [.NET TP Worker] ERROR CI.MessagingLibrary.Services.MailKitService - Failed to send e-mail: MailKit.Security.SslHandshakeException: An error occurred while attempting to establish an SSL or TLS connection.
When connecting to an SMTP service, port 25 is typically reserved for plain-text connections. If you intended to connect to SMTP on the SSL port, try connecting to port 465 instead. Otherwise, if you intended to use STARTTLS, make sure to use the following code:
client.Connect ("server.com", 25, SecureSocketOptions.StartTls);
---> System.Security.Authentication.AuthenticationException: Cannot determine the frame size or a corrupted frame was received. at System.Net.Security.SslStream.GetFrameSize(ReadOnlySpan.GetResult(Int16 token)
at System.Net.Security.SslStream.ReceiveHandshakeFrameAsync[TIOAdapter](CancellationToken cancellationToken)
at System.Net.Security.SslStream.ForceAuthenticationAsync[TIOAdapter](Boolean receiveFirst, Byte[] reAuthenticationData, CancellationToken cancellationToken)
at System.Net.Security.SslStream.AuthenticateAsClient(SslClientAuthenticationOptions sslClientAuthenticationOptions)
at MailKit.Net.Smtp.SmtpClient.Connect(String host, Int32 port, SecureSocketOptions options, CancellationToken cancellationToken)
--- End of inner exception stack trace ---
at MailKit.Net.Smtp.SmtpClient.Connect(String host, Int32 port, SecureSocketOptions options, CancellationToken cancellationToken)
1 buffer) at System.Net.Security.SslStream.EnsureFullTlsFrameAsync[TIOAdapter](CancellationToken cancellationToken, Int32 estimatedSize) at System.Runtime.CompilerServices.PoolingAsyncValueTaskMethodBuilder
1.StateMachineBox`1.System.Threading.Tasks.Sources.IValueTaskSource