Closed matrello closed 4 years ago
Hi Francesco,
What you configure in JSON ends up being the parameters that are passed to one of the WriteTo.Email(...)
methods... but there is no overload that accepts ALL the parameters you are passing.
If you look at the possible overloads (for example in here : https://github.com/serilog/serilog-sinks-email/blob/dev/src/Serilog.Sinks.Email/LoggerConfigurationEmailExtensions.cs ) you'll see the names you can pass :
public static LoggerConfiguration Email(
this LoggerSinkConfiguration loggerConfiguration,
string fromEmail,
string toEmail,
string outputTemplate = DefaultOutputTemplate,
LogEventLevel restrictedToMinimumLevel = LevelAlias.Minimum,
int batchPostingLimit = EmailSink.DefaultBatchPostingLimit,
TimeSpan? period = null,
IFormatProvider formatProvider = null,
string mailSubject = EmailConnectionInfo.DefaultSubject)
public static LoggerConfiguration Email(
this LoggerSinkConfiguration loggerConfiguration,
string fromEmail,
string toEmail,
string mailServer,
ICredentialsByHost networkCredential = null,
string outputTemplate = DefaultOutputTemplate,
LogEventLevel restrictedToMinimumLevel = LevelAlias.Minimum,
int batchPostingLimit = EmailSink.DefaultBatchPostingLimit,
TimeSpan? period = null,
IFormatProvider formatProvider = null,
string mailSubject = EmailConnectionInfo.DefaultSubject)
public static LoggerConfiguration Email(
this LoggerSinkConfiguration loggerConfiguration,
string fromEmail,
IEnumerable<string> toEmails,
string mailServer,
ICredentialsByHost networkCredential = null,
string outputTemplate = DefaultOutputTemplate,
LogEventLevel restrictedToMinimumLevel = LevelAlias.Minimum,
int batchPostingLimit = EmailSink.DefaultBatchPostingLimit,
TimeSpan? period = null,
IFormatProvider formatProvider = null,
string mailSubject = EmailConnectionInfo.DefaultSubject)
public static LoggerConfiguration Email(
this LoggerSinkConfiguration loggerConfiguration,
EmailConnectionInfo connectionInfo,
string outputTemplate = DefaultOutputTemplate,
LogEventLevel restrictedToMinimumLevel = LevelAlias.Minimum,
int batchPostingLimit = EmailSink.DefaultBatchPostingLimit,
TimeSpan? period = null,
IFormatProvider formatProvider = null,
string mailSubject = EmailConnectionInfo.DefaultSubject)
public static LoggerConfiguration Email(
this LoggerSinkConfiguration loggerConfiguration,
EmailConnectionInfo connectionInfo,
ITextFormatter textFormatter,
LogEventLevel restrictedToMinimumLevel = LevelAlias.Minimum,
int batchPostingLimit = EmailSink.DefaultBatchPostingLimit,
TimeSpan? period = null,
string mailSubject = EmailConnectionInfo.DefaultSubject)
For instance, you'll notice that :
port
parameterenableSsl
is not exposedEmailSubject
should be mailSubject
Thank you Thibaud, very clear now.
The EmailSubject attribute in appsettings.json is ignored: the subject is always "Log Email". v2.3.1-dev-00101. Possibly related to #34.
Thank you for your support!