serilog/serilog-sinks-email

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

cmeeren opened this issue · 3 comments

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?

EmailSinkOptions sets the default subject like this:

public ITextFormatter Subject { get; set; } = new MessageTemplateTextFormatter(DefaultSubject);

Thanks, works great! Should be documented.

Thanks, works great! Should be documented.

Yes, 'someone' should do that :P