serilog / serilog-sinks-email

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

documentation on how to configure credentials from the appsettings.json file #136

Open doreille opened 4 months ago

doreille commented 4 months ago

The configuration parameters have changed in version 3.0. Prior to version 3.0, SMTP credentials were configured using the userName and password attributes. From version 3.0 onwards, the SMTP credentials are configured using the credentials attribute which has the ICredentialsByHost interface type.

I haven't found any documentation or examples of how to set this. I try

"credentials": { "type": "System.Net.NetworkCredential, System.Net.Primitives", "UserName": "#########", "Password": "#########" }

but this return the error System.InvalidOperationException: 'Cannot create instance of type 'System.Net.ICredentialsByHost' because it is either abstract or an interface.'

jlrouzies-mantu commented 3 months ago

I agree Serilog documentations are lack luster when it comes to appsetting.json.

I am trying to fill "ConnectionSecurity": "StartTls", and I just get String error, and don't even know what to use instead.

bartelink commented 3 months ago

As evidenced by the three week lag and the noise of a "me too" on a duplicate, better to ask this on SO

alwilton commented 3 days ago

Perahps this will help .Net Core and Serilog Email sink - JSON Config