SyntaxCircus.Email
0.1.1
See the version list below for details.
dotnet add package SyntaxCircus.Email --version 0.1.1
NuGet\Install-Package SyntaxCircus.Email -Version 0.1.1
<PackageReference Include="SyntaxCircus.Email" Version="0.1.1" />
<PackageVersion Include="SyntaxCircus.Email" Version="0.1.1" />
<PackageReference Include="SyntaxCircus.Email" />
paket add SyntaxCircus.Email --version 0.1.1
#r "nuget: SyntaxCircus.Email, 0.1.1"
#:package SyntaxCircus.Email@0.1.1
#addin nuget:?package=SyntaxCircus.Email&version=0.1.1
#tool nuget:?package=SyntaxCircus.Email&version=0.1.1
SyntaxCircus.Email
An email-sending abstraction: a MailKit-based SMTP implementation with retry, plus Null (dev) and in-memory (test) implementations. Templating and composition are out of scope on purpose — too product-specific to generalize; this only covers the send primitive and provider switch.
No support guaranteed. Published as-is and maintained on a best-effort basis. Issues and PRs are welcome, but there's no SLA — fork it or vendor what you need if that's not enough.
Usage
builder.Services.AddSmtpEmailSender(builder.Configuration); // binds "Email:Smtp"
// or, in Development: builder.Services.AddNullEmailSender();
// or, in tests: builder.Services.AddInMemoryEmailSender();
{
"Email": {
"Smtp": {
"Host": "smtp.example.com",
"Port": 587,
"Username": "...",
"Password": "...",
"DefaultFrom": "noreply@example.com",
"MaxRetryAttempts": 3
}
}
}
public sealed class WelcomeEmailService(IEmailSender emailSender)
{
public Task SendWelcomeAsync(string to, CancellationToken ct)
=> emailSender.SendAsync(new EmailMessage(to, "Welcome!", "<p>Hi there.</p>"), ct);
}
SmtpEmailSender retries transient send failures with exponential backoff (MaxRetryAttempts, default 3). InMemoryEmailSender exposes SentMessages (and Clear()) for assertions in tests — resolve it directly (it's also registered as itself, not just as IEmailSender) when you need to inspect what was "sent".
Contributing
Issues and pull requests are welcome:
- Keep changes focused, with a clear description of the behavior change.
- Match the existing code style (see
.editorconfig). - Call out any breaking changes to the public API in your PR description.
License
MIT — see LICENSE.txt.
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | 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.0)
- Microsoft.Extensions.Configuration.Abstractions (>= 10.0.0)
- Microsoft.Extensions.DependencyInjection.Abstractions (>= 10.0.0)
- Microsoft.Extensions.Logging.Abstractions (>= 10.0.0)
- Microsoft.Extensions.Options (>= 10.0.0)
- Microsoft.Extensions.Options.ConfigurationExtensions (>= 10.0.0)
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.