Logger Mail
Overview
VersaTul.Logger.Mail implements the shared logger contract by sending log events as email.
It builds on the base logger package and the mailer package, adding throttling, batching, retry behavior, and a dead-letter queue for failed deliveries.
When To Use This Package
Use this package when you want to:
Send important operational events directly to an inbox.
Deliver HTML-formatted exception details.
Throttle bursts of log traffic instead of flooding recipients.
Batch excess messages during a throttle window.
Installation
Install the package with the .NET CLI:
dotnet add package VersaTul.Logger.Mail
Or with the Package Manager Console:
PM> NuGet\Install-Package VersaTul.Logger.Mail -Version latest
Core Types And Concepts
IMailLoggerandMailLoggerEmail-backed logger implementation.
IMailConfigurationSupplies sender, recipient, SMTP, attachment, and retry-related settings.
ILogParserProduces the HTML body sent for logged events.
Key Capabilities
Supports all
ILoggersync and async overloads.Formats mail bodies as HTML through
ILogParser.Retries transient delivery failures.
Throttles sends within a moving time window.
Batches overflow items and tracks failed sends in a dead-letter queue.
Basic Example
using VersaTul.Logger;
using VersaTul.Logger.Contracts;
using VersaTul.Logger.Mail;
ILogger logger = new MailLogger(dispatcher, mailConfiguration, new LogParser());
await logger.LogAsync(
new LogInfo(LogLevel.Error, "Payments", "Payment gateway timeout", traceId: "trace-456"),
new TimeoutException("Gateway timeout"));
Operational Notes
MailLogger exposes two useful counters:
DeadLetterCountfor failed deliveries that exhausted retries.PendingBatchCountfor throttled items waiting to be batched.
Notes
Throttling and batching are built into the logger implementation, not delegated to the mailer package.
This sink is best for high-value alerts, not high-volume debug traffic.
If send volume exceeds the configured window, messages are queued and later combined into a batched message.