serilog / serilog-sinks-email

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

Anonymous Credentials #46

Closed jamesSampica closed 6 months ago

jamesSampica commented 6 years ago

Is there a way to set anonymous credentials for the smtp client? When no network credentials are specified default credentials get used as per lines 147-148 on https://github.com/serilog/serilog-sinks-email/blob/dev/src/Serilog.Sinks.Email/Sinks/Email/EmailSink.cs

jkiebzak commented 5 years ago

@shoe788 this seems to work for me NetworkCredentials = new System.Net.NetworkCredential()

progmech commented 4 years ago

Hi, The solution provided by @jkiebzak (Thank you!) works for me, but I guess that it should be an additional parameter that will allow specifying the SmtpClient.UseDefaultCredentials option via App settings. Because with this solution I should use the code to initialize the sink.