Skip to content

Pragmatic.Email

Zero-dependency email for .NET — SMTP with connection pooling, DKIM / S/MIME signing, a middleware pipeline, and first-class testing support.

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

A small, dependency-free email library with a fluent message API, pooled SMTP connections, optional DKIM/S-MIME signing, a middleware pipeline (logging, retry, sandbox), and a test sink.

await email.SendAsync(new EmailMessage
{
From = "booking@hotel.com",
To = { guest.Email },
Subject = "Reservation Confirmed",
HtmlBody = "<h1>Confirmed</h1>...",
Attachments = { EmailAttachment.FromBytes("invoice.pdf", pdfBytes) },
});

Connections are pooled across sends; configure the transport once in the host.

Terminal window
dotnet add package Pragmatic.Email

SMTP transport, pooling, DKIM/S-MIME signing, the middleware pipeline, and test support are functional within the 0.8 preview. See the roadmap.

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

  • .NET 10.0+

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