serilog / serilog-sinks-email

A Serilog sink that writes events to SMTP email
Apache License 2.0
72 stars 68 forks source link

Modifying MailKit on non-SSL connections to pass in SecureSocketOptions.None #104

Closed jtenos closed 2 years ago

jtenos commented 2 years ago

MailKit will throw SslHandshakeException when you connect using useSsl: false.

In order to have a completely non-secure connection over port 25, you need to use the Connect overload with options: SecureSocketOptions.None.

https://stackoverflow.com/a/66066867/111266

From the MimeKit docs:

The useSsl argument only controls whether or not the client makes an SSL-wrapped connection. In other words, even if the useSsl parameter is false, SSL/TLS may still be used if the mail server supports the STARTTLS extension.

To disable all use of SSL/TLS, use the Connect(String, Int32, SecureSocketOptions, CancellationToken) overload with a value of SecureSocketOptions.None instead.

jtenos commented 2 years ago

Missing using statement...