Pragmatic.Email.Testing 1.0.0-alpha.1

This is a prerelease version of Pragmatic.Email.Testing.
There is a newer prerelease version of this package available.
See the version list below for details.
dotnet add package Pragmatic.Email.Testing --version 1.0.0-alpha.1
                    
NuGet\Install-Package Pragmatic.Email.Testing -Version 1.0.0-alpha.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="Pragmatic.Email.Testing" Version="1.0.0-alpha.1" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="Pragmatic.Email.Testing" Version="1.0.0-alpha.1" />
                    
Directory.Packages.props
<PackageReference Include="Pragmatic.Email.Testing" />
                    
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 Pragmatic.Email.Testing --version 1.0.0-alpha.1
                    
#r "nuget: Pragmatic.Email.Testing, 1.0.0-alpha.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 Pragmatic.Email.Testing@1.0.0-alpha.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=Pragmatic.Email.Testing&version=1.0.0-alpha.1&prerelease
                    
Install as a Cake Addin
#tool nuget:?package=Pragmatic.Email.Testing&version=1.0.0-alpha.1&prerelease
                    
Install as a Cake Tool

Pragmatic.Email

Email for .NET without a third-party mail library: SMTP with connection pooling, DKIM / S/MIME signing, a middleware pipeline, and first-class testing support.

The Problem

Sending email in .NET usually means pulling in MailKit (200K+ lines, dozens of transitive dependencies) for what should be straightforward, and you still hand-wire the message, with no connection pooling and no pipeline.

// Typical MailKit setup: new TCP connection every time, no pipeline
using var client = new SmtpClient();
await client.ConnectAsync("smtp.hotel.com", 587, SecureSocketOptions.StartTls);
await client.AuthenticateAsync("user", "pass");
await client.SendAsync(message);
await client.DisconnectAsync(true);

The Solution

A small email library (it depends only on Microsoft.Extensions.* abstractions and System.Security.Cryptography.Pkcs) with a fluent message API, pooled SMTP connections, optional DKIM/S-MIME signing, a middleware pipeline and in-memory/file transports for tests. The shipped middleware are DefaultFromMiddleware, DkimMiddleware and SmimeMiddleware; add your own with EmailBuilder.AddMiddleware<T>().

var message = new EmailMessageBuilder()
    .From("booking@hotel.com", "Hotel Booking")
    .To(guest.Email)
    .Subject("Reservation Confirmed")
    .HtmlBody("<h1>Confirmed</h1>...")
    .TextBody("Confirmed ...")
    .Attach("invoice.pdf", pdfBytes, "application/pdf")
    .Build();

EmailResult sent = await emailSender.SendAsync(message);   // IEmailSender

This module sends; it does not write the body. A mail a person reads comes from a .pdxemail template resolved against data (Pragmatic.Email.Templates, Pragmatic.Email.Model and Pragmatic.Documents.Email, all part of Pragmatic.Documents) and its HTML and text go into HtmlBody / TextBody here. See HTML email rendering.

Connections are pooled across sends; configure the transport once in the host. The builder validates addresses as you add them, so a malformed one fails where you wrote it rather than at send time.

Installation

dotnet add package Pragmatic.Email
dotnet add package Pragmatic.Email.Testing   # InMemoryTransport, FileTransport: test projects only

Status

Functional within 1.0.0-alpha: SMTP transport, pooling, DKIM and S/MIME signing, the middleware pipeline, and test support. See the roadmap.

TLS is negotiated with STARTTLS by default and switches to implicit TLS (SMTPS) automatically on port 465; set UseImplicitTls to force either mode. TimeoutSeconds bounds connect, reads and writes.

Known limit: bodies are sent as 8bit; quoted-printable is not implemented.

Documentation

Guide What you'll learn
Concepts Message model, transport, pooling, the middleware pipeline
Getting Started Send your first email, configure SMTP, test it
Common Mistakes The most frequent email pitfalls
Troubleshooting Problem/solution guide

Requirements

  • .NET 10.0+

License

Part of the Pragmatic.Design ecosystem. See Licensing. Pragmatic.Email is licensed under the PolyForm Small Business 1.0.0 license (free for small businesses; commercial license above the threshold).

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
1.0.0-alpha.6 96 11/21/2026
1.0.0-alpha.5 56 11/21/2026
1.0.0-alpha.4 118 11/16/2026
1.0.0-alpha.3 392 10/17/2026
1.0.0-alpha.2 126 10/12/2026
1.0.0-alpha.1 352 10/3/2026