Skip to content
This repository has been archived by the owner on Jun 14, 2022. It is now read-only.

Can't send mail without SSL / TLS #28

Open
definitio opened this issue May 17, 2021 · 1 comment
Open

Can't send mail without SSL / TLS #28

definitio opened this issue May 17, 2021 · 1 comment

Comments

@definitio
Copy link

definitio commented May 17, 2021

Enable SSL / TLS is unchecked. Mail server doesn't use SSL / TLS.
Log:

May 17 18:41:18 media jellyfin[117]: [18:41:18] [ERR] Error sending email
May 17 18:41:18 media jellyfin[117]: MailKit.Security.SslHandshakeException: An error occurred while attempting to establish an SSL or TLS connection.
May 17 18:41:18 media jellyfin[117]: The server's SSL certificate could not be validated for the following reasons:
May 17 18:41:18 media jellyfin[117]: • The server certificate has the following errors:
May 17 18:41:18 media jellyfin[117]:   • self signed certificate
May 17 18:41:18 media jellyfin[117]:  ---> System.Security.Authentication.AuthenticationException: The remote certificate was rejected by the provided RemoteCertificateValidationCallback.
May 17 18:41:18 media jellyfin[117]:    at System.Net.Security.SslStream.SendAuthResetSignal(ProtocolToken message, ExceptionDispatchInfo exception)
May 17 18:41:18 media jellyfin[117]:    at System.Net.Security.SslStream.ForceAuthenticationAsync[TIOAdapter](TIOAdapter adapter, Boolean receiveFirst, Byte[] reAuthenticationData, Boolean isApm)
May 17 18:41:18 media jellyfin[117]:    at MailKit.Net.Smtp.SmtpClient.ConnectAsync(String host, Int32 port, SecureSocketOptions options, Boolean doAsync, CancellationToken cancellationToken)
May 17 18:41:18 media jellyfin[117]:    --- End of inner exception stack trace ---
May 17 18:41:18 media jellyfin[117]:    at MailKit.Net.Smtp.SmtpClient.ConnectAsync(String host, Int32 port, SecureSocketOptions options, Boolean doAsync, CancellationToken cancellationToken)
May 17 18:41:18 media jellyfin[117]:    at MediaBrowser.Plugins.SmtpNotifications.Notifier.SendNotification(UserNotification request, CancellationToken cancellationToken)
May 17 18:41:18 media jellyfin[117]: [18:41:18] [WRN] Slow HTTP Response from http://jellyfin.home/Notification/SMTP/Test/5cc7bde5a02e47b2a3f8029c8916c899 to 10.10.1.50 in 0:00:00.8615494 with Status Code 204
@quielb
Copy link

quielb commented Nov 3, 2021

I also have this issue. It looks like there are two things that are causing this.

The first is how the option is stored in config. I don't know C# well enough to know if the option is read back in as a string or a boolean. Either way that value need to be "evaluated".

In MediaBrowser.Plugins.SmtpNotifications/Notifier.cs on line 52 client.ConnectAsync is called passing in options.SSL which is read from the config file. That value is either or boolean or a string, but neither type is correct. The function requires an enum of type SecureSocketOptions from MailKit.Security

I think there needs to be a line of code before the connect is called to evaluate the option and set the enum correctly:
(Assuming bool type from config)

SecureSocketOptions use-SSL = options.SSL ? SecureSocketOptions.Auto : SecureSocketOptions.None;

Then replace options.SSL with use-SSL in client.ConnectAsync

As a work around I have disabled TLS on my internal MAIL relay. Since it's internal it's not really needed.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Development

No branches or pull requests

2 participants