Using custom text formatter screws mail subject
Closed this issue · 2 comments
arvigeus commented
Version: 2.3.0
var logger = new LoggerConfiguration()
logger .Enrich.FromLogContext();
logger.WriteTo.Email(new EmailConnectionInfo()
{
EmailSubject = $"DotNet Core Web Dump For {mspName}", // <-- Does not work with textFormatter
FromEmail = "api@shopmetrics.com",
IsBodyHtml = true,
MailServer = "10.10.110.32",
ToEmail = "nstoynov@shopmetrics.com"
},
textFormatter: new HtmlFormatter(), // <-- Using this makes EmailSubject to be default subject
restrictedToMinimumLevel: LogEventLevel.Error);
HtmlFormatter is a custom formatter. Could not find any way to set subject from there.
ddementyev commented
Hi, in this case it is necessary to use the email subject not in the EmailConnectionInfo but after the text formatter like this: subject: "your subject":
textFormatter: new HtmlFormatter(),
mailSubject: "subject", // <-- This will work
restrictedToMinimumLevel: LogEventLevel.Error);
nblumhardt commented
Closing as stale; 3.0.0-dev makes some improvements to the configuration options around this.