I want to use Serilog.Sinks.Mail with config settings storred in an appsettings json file and the possibilty to dynamically change the subject and the mail receiver for every mail I send. I set {Message} for the mailSubject and with that I get the first words from my log message into my subject, but I want to predefine the subject for every mail.
Example: At event A send a mail to PersonA@something.com with subject "Event A". At event B send a mail to PersonB@something.com with subject "Event B" and so on.
Is there a way to do that with Serilog or should I use something else for the mails?
At the moment my appsettings for mails looks like this:
{
"Name": "Email",
"Args": {
"fromEmail": "fromEmail@something.com",
"toEmail": "testmail@something.com",
"mailServer": "testmailServer",
"batchPostingLimit": 1,
"mailSubject": "{Message}",
"outputTemplate": "{Timestamp:yyyy-MM-dd HH:mm:ss} [{Level}] {Message}{NewLine:1}{Exception:1}"
}