An open API service indexing awesome lists of open source software.

https://github.com/nlog/nlog.targets.mail

NLog target for sending logevents as email messages using SMTP
https://github.com/nlog/nlog.targets.mail

csharp dotnet email-sender nlog nlog-target smtp-client

Last synced: about 1 month ago
JSON representation

NLog target for sending logevents as email messages using SMTP

Awesome Lists containing this project

README

          

# NLog Mail Target

[![Version](https://badge.fury.io/nu/NLog.Targets.Mail.svg)](https://www.nuget.org/packages/NLog.Targets.Mail)
[![AppVeyor](https://img.shields.io/appveyor/ci/NLog/NLog-Targets-Mail/master.svg)](https://ci.appveyor.com/project/nlog/NLog-Targets-Mail/branch/master)

NLog Mail Target for sending email using .NET SmtpClient for each logevent.
- Can also be combined with [FallbackGroup](https://github.com/NLog/NLog/wiki/FallbackGroup-target) to fallback to alternative SMTP-server on error.
- Can also be combined with [BufferingWrapper](https://github.com/NLog/NLog/wiki/BufferingWrapper-target) to group multiple logevents into a single email.
- Can also be combined with [LimitingWrapper](https://github.com/NLog/NLog/wiki/LimitingWrapper-target) to throttle the number of emails.
- Can also be combined with [FilteringWrapper](https://github.com/NLog/NLog/wiki/FilteringWrapper-target) to avoid repeating identical emails.

If having trouble with output, then check [NLog InternalLogger](https://github.com/NLog/NLog/wiki/Internal-Logging) for clues. See also [Troubleshooting NLog](https://github.com/NLog/NLog/wiki/Logging-Troubleshooting)

See the [NLog Wiki](https://github.com/NLog/NLog/wiki/Mail-target) for available options and examples.

Note there is also an alternative [NLog.MailKit](https://www.nuget.org/packages/NLog.MailKit)-nuget-package that depends on the MailKit-library.

## Register Extension

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

```xml

```

Alternative register from code using [fluent configuration API](https://github.com/NLog/NLog/wiki/Fluent-Configuration-API):

```csharp
LogManager.Setup().SetupExtensions(ext => {
ext.RegisterTarget();
});
```