Skip to content

A fork from Serilog.Sink.Email, using System.Net.Mail instead of MailKit to be able to use UseDefaultCredentials.

License

Notifications You must be signed in to change notification settings

jlrouzies-mantu/serilog-sinks-netmail

Repository files navigation

Serilog.Sinks.NetMail Build status

ℹ️ Based on Serilog.Sinks.Email

Sends log events by SMTP email, using System.Net.Mail.

await using var log = new LoggerConfiguration()
    .WriteTo.NetMail(
        from: "[email protected]",
        to: "[email protected]",
        host: "smtp.example.com")
    .CreateLogger();

Supported options are:

Parameter Description
from The email address emails will be sent from.
to The email address emails will be sent to. Multiple addresses can be separated with commas or semicolons.
host The SMTP server to use.
port The port used for the SMTP connection. The default is 25.
enableSSL Enable SSL
credentials The network credentials to use to authenticate with the mail server.
useDefaultCredentials Use the Default Credentials, useful e.g. for NTML / Kerberos
subject A message template describing the email subject. The default is "Log Messages".
body A message template describing the format of the email body. The default is "{Timestamp} [{Level}] {Message}{NewLine}{Exception}".
bodyIsHtml Enables HTML support for body. Note unlike Email sink, there is no need for further custom code / method. It is native of System.Net.Mail.
formatProvider Supplies culture-specific formatting information. The default is to use the current culture.

An overload accepting EmailSinkOptions can be used to specify advanced options such as batched and/or HTML body templates.

About

A fork from Serilog.Sink.Email, using System.Net.Mail instead of MailKit to be able to use UseDefaultCredentials.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published