Closed gaazkam closed 11 months ago
@gaazkam It does use mailkit, so i'm not sure what you are referencing here. See here: https://github.com/serilog/serilog-sinks-email/blob/dev/src/Serilog.Sinks.Email/Sinks/Email/MailKitEmailTransport.cs
It does not use Mailkit on Framework: https://github.com/serilog/serilog-sinks-email/blob/644fe13c006ed470aaa7ce4774f224cca73fa7b7/src/Serilog.Sinks.Email/Sinks/Email/EmailConnectionInfo.cs#L110
The SystemMailEmailTransport
should be removed.
3.0.0-dev-* packages now use MailKit and support all options on .NET Framework.
The way I'm getting things is that the Email sink uses the deprecated
System.Net.Mail.SmtpClient
class if run on Framework and MailKit if run on Core or Standard. This behavior doesn't seem documented and I had to read the source code to find this out.However,
SmtpClient
is disrecommended by Microsoft:In particular, SmtpClient does not support authenticating against SMTP servers on port 465. For this reason I was unable to make Serilog.Sinks.Email send emails. MailKit doesn't seem to have this limitation.
Unfortunately, thanks to third party library compatilbility requirements, I'm still stuck on Framework and this is expected to last for about two years.
Considering that MailKit does target Framework I think it would make sense to use MailKit even on Framework projects. Failing that I think it would make sense to add a configuration option to opt in to the use of MailKit even on Framework. In any case I think that the choice of mailing backends depending on .Net version should be explicitly documented.