mailpit-integration

Test email sending locally with Mailpit and .NET Aspire integration.

Updated Mar 8, 2026
One-click install
npx skills add https://github.com/AGIBuild/dotnet.CI.template --skill mailpit-integration-agibuild
Or copy as Structured Prompt for Agent▼
Please help me install this Agent Skill.
Skill: mailpit-integration
Source: https://github.com/AGIBuild/dotnet.CI.template/tree/main/.cursor/skills/aspire-mailpit-integration
Command: npx skills add https://github.com/AGIBuild/dotnet.CI.template --skill mailpit-integration-agibuild

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve? Sending real emails during local development and testing is risky and slow. This Skill captures all outgoing SMTP traffic with Mailpit inside a .NET Aspire AppHost, so you can inspect rendered HTML, headers, and attachments without delivering a single message. ## Core Features & Use Cases - Aspire AppHost Setup: Add Mailpit as a container with SMTP and web UI endpoints, wired into your API project via environment configuration. - SMTP Email Sender: Implement an IEmailSender using MailKit with environment-aware settings for development and production. - Integration Testing: Use a Mailpit API client and Aspire test fixture to assert emails are sent, wait for async delivery, and verify content like password reset links. - Use Case: While building a signup flow, run integration tests that trigger registration, then assert via the Mailpit API that exactly one welcome email with the correct subject and HTML body was captured. ## Quick Start Set up Mailpit in my Aspire AppHost and write an integration test that verifies the signup flow sends a welcome email.

Frequently Asked Questions about mailpit-integration

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I test email sending locally without sending real emails?▼

Use Mailpit, a lightweight SMTP server that captures all outgoing emails without delivering them. Add it as a container in your .NET Aspire AppHost, point your app's SMTP settings at it, and view captured messages in its web UI on port 8025.

How to verify emails are sent in .NET Aspire integration tests?▼

Create a MailpitClient that calls the Mailpit HTTP API endpoints like /api/v1/messages. In your test fixture, start the Aspire app, clear messages, trigger the workflow, then assert on captured subjects, recipients, and HTML bodies.

What library should I use to send SMTP email in .NET?▼

MailKit is the recommended library for SMTP in modern .NET. It supports async sending, authentication, and SSL options, and works with Mailpit in development by connecting without SSL or credentials on port 1025.

Does Mailpit work with .NET Aspire dashboard?▼

Yes. When you add Mailpit as a container resource with named endpoints in the AppHost, its web UI endpoint appears in the Aspire dashboard under Resources, giving one-click access to the captured email inbox.

Why are my emails not appearing in Mailpit?▼

First confirm the Mailpit container is running in the Aspire dashboard, then verify your app's SMTP host and port configuration matches the container endpoint. Check application logs for connection exceptions and test the API with curl on port 8025.

How do I test emails sent asynchronously in background workflows?▼

Poll the Mailpit API with a WaitForMessageAsync helper that retries with a short delay until a matching message arrives or a timeout expires. This handles emails sent by background jobs or event handlers after the HTTP response completes.