NetEvolve.HealthPublishers.Email
1.13.10
Prefix Reserved
dotnet add package NetEvolve.HealthPublishers.Email --version 1.13.10
NuGet\Install-Package NetEvolve.HealthPublishers.Email -Version 1.13.10
<PackageReference Include="NetEvolve.HealthPublishers.Email" Version="1.13.10" />
<PackageVersion Include="NetEvolve.HealthPublishers.Email" Version="1.13.10" />
<PackageReference Include="NetEvolve.HealthPublishers.Email" />
paket add NetEvolve.HealthPublishers.Email --version 1.13.10
#r "nuget: NetEvolve.HealthPublishers.Email, 1.13.10"
#:package NetEvolve.HealthPublishers.Email@1.13.10
#addin nuget:?package=NetEvolve.HealthPublishers.Email&version=1.13.10
#tool nuget:?package=NetEvolve.HealthPublishers.Email&version=1.13.10
NetEvolve.HealthPublishers.Email
An IHealthCheckPublisher implementation that sends HealthReport results as an email, using MailKit to connect directly to an SMTP server.
Features
- Sends a single plain-text email per publish, summarizing the overall report status, elapsed time, and a per-check breakdown
- Subject line includes the overall
HealthStatusand the configuredSystemIdentifier, for quick triage in an inbox - Tags every email with the machine name and a required, free-form
SystemIdentifierto tell instances apart - Supports connecting without authentication, or with username/password credentials, over plain,
StartTls, or implicit TLS/SSL connections - Configuration- or builder-based setup, consistent with the
NetEvolve.HealthPublishers.*conventions - Named registrations to send to multiple SMTP servers or recipient lists side by side
- Debounces notifications instead of emailing on every publish: a worsening status is emailed immediately, while an improving status must stay sustained for a configurable delay before a "recovery" email is sent
- Includes a timestamp in the email body, converted to a configurable time zone (defaults to
Europe/Berlin)
Installation
NuGet Package Manager
Install-Package NetEvolve.HealthPublishers.Email
.NET CLI
dotnet add package NetEvolve.HealthPublishers.Email
PackageReference
<PackageReference Include="NetEvolve.HealthPublishers.Email" Version="x.x.x" />
Quick Start
using NetEvolve.HealthPublishers.Email;
var builder = services.AddHealthChecks();
builder.AddEmailPublisher(options =>
{
options.Host = "smtp.example.com";
options.Port = 587;
options.From = "health-checks@example.com";
options.To = ["ops-team@example.com"];
options.SystemIdentifier = "checkout-service";
});
Usage
Basic Example
Register under the default name ("Default"), configured via code:
var builder = services.AddHealthChecks();
builder.AddEmailPublisher(options =>
{
options.Host = "smtp.example.com"; // Required
options.Port = 587; // Required
options.From = "health-checks@example.com"; // Required
options.To = ["ops-team@example.com"]; // Required, at least one address
options.SystemIdentifier = "checkout-service"; // Required, tags the email alongside the machine name
options.Username = "smtp-user"; // Optional, requires Password to be set as well
options.Password = "<password>"; // Optional, requires Username to be set as well
});
Notification Behavior
The publisher keeps track of the HealthStatus it last actually emailed about (per registered instance) and does not
send an email for every PublishAsync call:
- Same status as last notified: no email is sent.
- Worsening status (e.g.
Healthy→Degraded,Degraded→Unhealthy, orHealthy→Unhealthy): an email is sent immediately, regardless ofRecoveryConfirmationDelay. - Improving status (e.g.
Degraded→Healthy,Unhealthy→Degraded, orUnhealthy→Healthy): the improvement must be sustained for at leastRecoveryConfirmationDelaybefore a "recovery" email is sent. If the status regresses back to the last-notified status before the delay elapses, no email is sent and the delay resets; a later improvement starts a new delay from scratch. If the status regresses to something worse than the last-notified status instead, that is treated as a new worsening event and is emailed immediately.
Advanced Example
Register multiple named Email targets, each sending the same health reports to a different SMTP server or recipient list:
var builder = services.AddHealthChecks();
builder.AddEmailPublisher("Internal", options =>
{
options.Host = "smtp.example.com";
options.Port = 587;
options.From = "health-checks@example.com";
options.To = ["internal-ops@example.com"];
options.SystemIdentifier = "checkout-service";
});
builder.AddEmailPublisher("External", options =>
{
options.Host = "smtp-external.example.com";
options.Port = 587;
options.From = "health-checks@example.com";
options.To = ["external-ops@example.com"];
options.SystemIdentifier = "checkout-service";
});
Configuration
Code-based
builder.AddEmailPublisher(options =>
{
options.Host = "smtp.example.com"; // Required
options.Port = 587; // Required
options.SecureSocketOptions = SecureSocketOptions.StartTls; // Optional, defaults to SecureSocketOptions.Auto
options.From = "health-checks@example.com"; // Required
options.To = ["ops-team@example.com"]; // Required
options.SystemIdentifier = "checkout-service"; // Required
options.Username = "smtp-user"; // Optional
options.Password = "<password>"; // Optional
options.RecoveryConfirmationDelay = TimeSpan.FromMinutes(10); // Optional, defaults to 5 minutes, minimum 5 minutes
options.TimeZoneId = "Europe/Berlin"; // Optional, defaults to "Europe/Berlin"
});
appsettings.json-based
builder.AddEmailPublisher(); // reads the "Default" section below
{
"HealthPublishers": {
"Email": {
"Default": {
"Host": "smtp.example.com",
"Port": 587,
"SecureSocketOptions": "StartTls",
"From": "health-checks@example.com",
"To": ["ops-team@example.com"],
"SystemIdentifier": "checkout-service",
"Username": "smtp-user",
"Password": "<password>",
"RecoveryConfirmationDelay": "00:10:00",
"TimeZoneId": "Europe/Berlin"
}
}
}
}
When using an explicit name, the section key must match: builder.AddEmailPublisher("Internal") reads HealthPublishers:Email:Internal.
Requirements
- .NET 8.0 or higher
- A reachable SMTP server
Related Packages
- NetEvolve.HealthPublishers.Abstractions - Shared abstractions used by all
NetEvolve.HealthPublishers.*packages
Documentation
For complete documentation, please visit the official documentation.
Contributing
Contributions are welcome! Please read the Contributing Guidelines before submitting a pull request.
Support
- Issues: Report bugs or request features on GitHub Issues
- Documentation: Read the full documentation at https://github.com/dailydevops/healthpublishers
License
This project is licensed under the MIT License - see the LICENSE file for details.
Made with ❤️ by the NetEvolve Team Visit us at https://www.daily-devops.net for more information about our services and solutions.
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | net8.0 is compatible. net8.0-android was computed. net8.0-browser was computed. net8.0-ios was computed. net8.0-maccatalyst was computed. net8.0-macos was computed. net8.0-tvos was computed. net8.0-windows was computed. net9.0 is compatible. net9.0-android was computed. net9.0-browser was computed. net9.0-ios was computed. net9.0-maccatalyst was computed. net9.0-macos was computed. net9.0-tvos was computed. net9.0-windows was computed. net10.0 is compatible. net10.0-android was computed. net10.0-browser was computed. net10.0-ios was computed. net10.0-maccatalyst was computed. net10.0-macos was computed. net10.0-tvos was computed. net10.0-windows was computed. |
-
net10.0
- MailKit (>= 4.17.0)
- Microsoft.Extensions.Configuration (>= 10.0.11)
- Microsoft.Extensions.Configuration.Abstractions (>= 10.0.11)
- Microsoft.Extensions.Configuration.Binder (>= 10.0.11)
- Microsoft.Extensions.DependencyInjection.Abstractions (>= 10.0.11)
- Microsoft.Extensions.Diagnostics.HealthChecks (>= 10.0.11)
- Microsoft.Extensions.Options (>= 10.0.11)
-
net8.0
- MailKit (>= 4.17.0)
- Microsoft.Extensions.Configuration (>= 10.0.11)
- Microsoft.Extensions.Configuration.Abstractions (>= 10.0.11)
- Microsoft.Extensions.Configuration.Binder (>= 10.0.11)
- Microsoft.Extensions.DependencyInjection.Abstractions (>= 10.0.11)
- Microsoft.Extensions.Diagnostics.HealthChecks (>= 10.0.11)
- Microsoft.Extensions.Options (>= 10.0.11)
-
net9.0
- MailKit (>= 4.17.0)
- Microsoft.Extensions.Configuration (>= 10.0.11)
- Microsoft.Extensions.Configuration.Abstractions (>= 10.0.11)
- Microsoft.Extensions.Configuration.Binder (>= 10.0.11)
- Microsoft.Extensions.DependencyInjection.Abstractions (>= 10.0.11)
- Microsoft.Extensions.Diagnostics.HealthChecks (>= 10.0.11)
- Microsoft.Extensions.Options (>= 10.0.11)
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.
| Version | Downloads | Last Updated |
|---|---|---|
| 1.13.10 | 25 | 8/23/2026 |