Skip to content

Repository files navigation

NLog Mail Target

Version AppVeyor

NLog Mail Target for sending email using .NET SmtpClient for each logevent.

If having trouble with output, then check NLog InternalLogger for clues. See also Troubleshooting NLog

See the NLog Wiki for available options and examples.

Note there is also an alternative NLog.MailKit-nuget-package that depends on the MailKit-library.

⚠️ Microsoft recommends not to use the SmtpClient class for new development because SmtpClient doesn't support many modern protocols. Use MailKit or other libraries instead. For more information, see SmtpClient shouldn't be used.

Register Extension

NLog will only recognize type-alias Mail when loading from NLog.config-file, if having added extension to NLog.config-file:

<extensions>
    <add assembly="NLog.Targets.Mail"/>
</extensions>

Alternative register from code using fluent configuration API:

LogManager.Setup().SetupExtensions(ext => {
   ext.RegisterTarget<NLog.Targets.MailTarget>();
});

About

NLog target for sending logevents as email messages using SMTP

Topics

Resources

Stars

Watchers

Forks

Releases

Packages

Used by

Contributors

Languages