jellyfin-plugin-webhook icon indicating copy to clipboard operation
jellyfin-plugin-webhook copied to clipboard

SMTP SSL with StartTls

Open SamuraiMarv opened this issue 2 years ago • 2 comments

Downloaded the plugin and configured it, however I cannot get it to work on port 587 with SSL turned on. My mail server requires SSL and port 587. I have tested the same config with SSL turned off and it successfully sends an email out.

I don't see an option in any of the SMTP settings for enabling StartTLS, which is required to send SSL over port 587. Below is the error I get in the logs when trying to send it on port 587 with SSL enabled.

`[16:08:58] [WRN] [21] Jellyfin.Plugin.Webhook.Destinations.Smtp.SmtpClient: Error sending email MailKit.Security.SslHandshakeException: An error occurred while attempting to establish an SSL or TLS connection.

When connecting to an SMTP service, port 587 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 ("smtp.mail.me.com", 587, SecureSocketOptions.StartTls);

---> System.IO.IOException: Cannot determine the frame size or a corrupted frame was received. at System.Net.Security.SslStream.GetFrameSize(ReadOnlySpan1 buffer) at System.Net.Security.SslStream.ReceiveBlobAsync[TIOAdapter](TIOAdapter adapter) at System.Net.Security.SslStream.ForceAuthenticationAsync[TIOAdapter](TIOAdapter adapter, Boolean receiveFirst, Byte[] reAuthenticationData, Boolean isApm) at MailKit.Net.Smtp.SmtpClient.ConnectAsync(String host, Int32 port, SecureSocketOptions options, Boolean doAsync, CancellationToken cancellationToken) --- End of inner exception stack trace --- at MailKit.Net.Smtp.SmtpClient.ConnectAsync(String host, Int32 port, SecureSocketOptions options, Boolean doAsync, CancellationToken cancellationToken) at Jellyfin.Plugin.Webhook.Destinations.Smtp.SmtpClient.SendAsync(SmtpOption option, Dictionary2 data)`

SamuraiMarv avatar Jan 05 '23 21:01 SamuraiMarv

+1

MailKit.Security.SslHandshakeException: An error occurred while attempting to establish an SSL or TLS connection.

When connecting to an SMTP service, port 587 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 ("mail.redacted.url", 587, SecureSocketOptions.StartTls);

aTosser avatar Apr 25 '23 03:04 aTosser

+1

MailKit.Security.SslHandshakeException: An error occurred while attempting to establish an SSL or TLS connection.

When connecting to an SMTP service, port 587 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 ("mail.redacted.url", 587, SecureSocketOptions.StartTls);

I am attempting to use StartTls, where would I put this code in the plugin? client.Connect ("mail.redacted.url", 587, SecureSocketOptions.StartTls);

SamuraiMarv avatar Apr 25 '23 13:04 SamuraiMarv