serilog / serilog-sinks-email

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

How to set subject and body template in code when using batching #127

Closed cmeeren closed 4 months ago

cmeeren commented 4 months ago

When using batching, I must specify an EmailSinkOptions in WriteTo.Email. Unlike the "loose" parameter overload of WriteTo.Email, EmailSinkOptions.Body and EmailSinkOptions.Subject are of type ITextFormatter. How can I set a simple string subject and body template when using batching, like I could pre-3.0?

Randactyl commented 4 months ago

EmailSinkOptions sets the default subject like this: https://github.com/serilog/serilog-sinks-email/blob/ac58ea6161142e2ab4f22df3e863eb36104c0c53/src/Serilog.Sinks.Email/Sinks/Email/EmailSinkOptions.cs#L75

cmeeren commented 4 months ago

Thanks, works great! Should be documented.

bartelink commented 4 months ago

Thanks, works great! Should be documented.

Yes, 'someone' should do that :P