Pragmatic.Email.Testing
1.0.0-alpha.5
See the version list below for details.
dotnet add package Pragmatic.Email.Testing --version 1.0.0-alpha.5
NuGet\Install-Package Pragmatic.Email.Testing -Version 1.0.0-alpha.5
<PackageReference Include="Pragmatic.Email.Testing" Version="1.0.0-alpha.5" />
<PackageVersion Include="Pragmatic.Email.Testing" Version="1.0.0-alpha.5" />
<PackageReference Include="Pragmatic.Email.Testing" />
paket add Pragmatic.Email.Testing --version 1.0.0-alpha.5
#r "nuget: Pragmatic.Email.Testing, 1.0.0-alpha.5"
#:package Pragmatic.Email.Testing@1.0.0-alpha.5
#addin nuget:?package=Pragmatic.Email.Testing&version=1.0.0-alpha.5&prerelease
#tool nuget:?package=Pragmatic.Email.Testing&version=1.0.0-alpha.5&prerelease
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 | 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
- Microsoft.Extensions.DependencyInjection.Abstractions (>= 10.0.10)
- Pragmatic.Email (>= 1.0.0-alpha.5)
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 |