SyntaxCircus.Email
0.1.4
See the version list below for details.
dotnet add package SyntaxCircus.Email --version 0.1.4
NuGet\Install-Package SyntaxCircus.Email -Version 0.1.4
<PackageReference Include="SyntaxCircus.Email" Version="0.1.4" />
<PackageVersion Include="SyntaxCircus.Email" Version="0.1.4" />
<PackageReference Include="SyntaxCircus.Email" />
paket add SyntaxCircus.Email --version 0.1.4
#r "nuget: SyntaxCircus.Email, 0.1.4"
#:package SyntaxCircus.Email@0.1.4
#addin nuget:?package=SyntaxCircus.Email&version=0.1.4
#tool nuget:?package=SyntaxCircus.Email&version=0.1.4
SyntaxCircus.Email
SyntaxCircus.Email is a small .NET email-delivery primitive. It supplies an IEmailSender
abstraction with SMTP/MailKit, null/logging, and in-memory implementations. It intentionally does
not provide templates, rendering, queueing, delivery tracking, or application-specific message
composition.
No support guaranteed. Published as-is and maintained on a best-effort basis. Issues and PRs are welcome, but there is no SLA.
Choose an implementation
| Environment or need | Registration | Behavior |
|---|---|---|
| Production SMTP | AddSmtpEmailSender(configuration) |
Sends through MailKit SMTP with exponential retry. |
| Local development | AddNullEmailSender() |
Logs recipient and subject; sends no email. |
| Application tests | AddInMemoryEmailSender() |
Captures messages in memory; sends no email. |
| Runtime-managed SMTP settings | Register ISmtpOptionsProvider, then call AddSmtpEmailSender. |
Resolves one complete SMTP snapshot for each send. |
Register exactly one IEmailSender implementation for the service provider that sends mail.
Quick start
builder.Services.AddSmtpEmailSender(builder.Configuration);
{
"Email": {
"Smtp": {
"Host": "smtp.example.com",
"Port": 587,
"Username": "smtp-user",
"Password": "store-this-in-a-secret-provider",
"UseStartTls": true,
"DefaultFrom": "noreply@example.com",
"MaxRetryAttempts": 3
}
}
}
public sealed class WelcomeEmailService(IEmailSender emailSender)
{
public Task SendWelcomeAsync(string to, CancellationToken cancellationToken)
=> emailSender.SendAsync(
new EmailMessage(to, "Welcome!", "<p>Thanks for joining.</p>"),
cancellationToken);
}
For a paired HTML and plain-text message, supply PlainTextBody while leaving IsBodyHtml as
true:
await emailSender.SendAsync(new EmailMessage(
"person@example.com",
"Welcome!",
"<p>Thanks for joining.</p>",
PlainTextBody: "Thanks for joining."),
cancellationToken);
Documentation
- Package guide - public API, sender selection, message semantics, SMTP behavior, retries, cancellation, concurrency, and operational boundaries.
- Runtime SMTP options - static versus database/secret-backed SMTP settings, provider lifecycle, registration order, security, and migration.
- Testing guide - null and in-memory senders, assertions, and advanced transport test seams.
- Agent instructions - repository contracts for AI agents and automated contributors.
Security note
Do not commit SMTP passwords. Use a secret provider or an application-owned
ISmtpOptionsProvider, and never log SmtpOptions.Password or decrypted credentials.
Contributing
Keep changes focused, match .editorconfig, update the relevant package and agent documentation,
and call out public API or behavior changes in pull requests.
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.