.NETASP.NET CoreTestingDeveloper Toolsopen source

MailPeek: Stop Sending Test Emails to Real People

You know that sinking feeling when you realise the “welcome” email your app just sent went to a real customer because someone left a production SMTP connection string in .env.local? MailPeek exists to make that impossible.

MailPeek is an in-memory fake SMTP server for ASP.NET Core. Your app thinks it’s sending email. MailPeek catches every message and shows it in a real-time web dashboard — subject, body, headers, attachments, the works. Nothing leaves your machine.

Setup

dotnet add package MailPeek
// Program.cs
builder.Services.AddMailPeek();

app.UseMailPeek(); // serves dashboard at /mailpeek

That’s it. MailPeek registers a fake ISmtpClient and intercepts any email sent through it. The dashboard auto-updates over SignalR — no polling, no refresh.

Works with .NET Aspire

If you’re using .NET Aspire, MailPeek integrates with service discovery out of the box. Add it to your AppHost and it shows up alongside your other services in the dashboard.

Why Not Just Log Emails?

Logging gives you text. MailPeek gives you a rendered preview of exactly what your users would see — HTML body, plain-text fallback, MIME structure. Useful when you’re debugging template rendering or multipart encoding.


Available on NuGet · Source on GitHub