SyntaxCircus.Email 0.1.1

There is a newer version of this package available.
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
                    
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="SyntaxCircus.Email" Version="0.1.1" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="SyntaxCircus.Email" Version="0.1.1" />
                    
Directory.Packages.props
<PackageReference Include="SyntaxCircus.Email" />
                    
Project file
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add SyntaxCircus.Email --version 0.1.1
                    
#r "nuget: SyntaxCircus.Email, 0.1.1"
                    
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
#:package SyntaxCircus.Email@0.1.1
                    
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=SyntaxCircus.Email&version=0.1.1
                    
Install as a Cake Addin
#tool nuget:?package=SyntaxCircus.Email&version=0.1.1
                    
Install as a Cake Tool

SyntaxCircus.Email

Build NuGet License: MIT

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 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. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

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
0.1.5 141 8/30/2026
0.1.4 102 8/18/2026
0.1.3 103 8/18/2026
0.1.2 102 8/18/2026
0.1.1 105 8/16/2026