SyntaxCircus.Email 0.1.5

dotnet add package SyntaxCircus.Email --version 0.1.5
                    
NuGet\Install-Package SyntaxCircus.Email -Version 0.1.5
                    
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.5" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="SyntaxCircus.Email" Version="0.1.5" />
                    
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.5
                    
#r "nuget: SyntaxCircus.Email, 0.1.5"
                    
#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.5
                    
#: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.5
                    
Install as a Cake Addin
#tool nuget:?package=SyntaxCircus.Email&version=0.1.5
                    
Install as a Cake Tool

SyntaxCircus.Email

Build NuGet License: MIT

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);

To attach a file and set a Reply-To address, use EmailAttachment and ReplyTo:

await emailSender.SendAsync(new EmailMessage(
    "person@example.com",
    "Your certificate",
    "<p>Attached is your certificate.</p>",
    ReplyTo: "support@example.com",
    Attachments: [new EmailAttachment("certificate.pdf", pdfBytes, "application/pdf")]),
    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 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