Mailpit Integration
Test email sending locally using Mailpit with .NET Aspire.
Install
npx skills add Aaronontheweb/dotnet-skills --skill mailpit-integration -g -a claude-code -y- Repository
- Aaronontheweb/dotnet-skills1.2k
- Category
- Testing
- Updated
- 7d ago
- License
- MIT
- Context cost
- Mediumabout 2,782 tokens
- Runs scripts
- No, instructions only
What it does
Test email sending locally using Mailpit with .NET Aspire. Captures all outgoing emails without sending them. View rendered HTML, inspect headers, and verify delivery in integration tests.
Email Testing with Mailpit and .NET Aspire
When to Use This Skill
Use this skill when:
- Testing email delivery locally without sending real emails
- Setting up email infrastructure in .NET Aspire
- Writing integration tests that verify emails are sent
- Debugging email rendering and headers
Related skills:
aspnetcore/mjml-email-templates- MJML template authoringtesting/verify-email-snapshots- Snapshot test rendered HTMLaspire/integration-testing- General Aspire testing patterns
What is Mailpit?
Mailpit is a lightweight email testing tool that:
- Captures all SMTP traffic without delivering emails
- Provides a web UI to view captured emails
- Exposes an API for programmatic access
- Supports HTML rendering, headers, and attachments
Perfect for development and integration testing.
Aspire AppHost Configuration
Add Mailpit as a container in your AppHost:
// AppHost/Program.cs
var builder = DistributedApplication.CreateBuilder(args);
// Add Mailpit for email testing
var mailpit = builder.AddContainer("mailpit", "axllent/mailpit")
.WithHttpEndpoint(port: 8025, targetPort: 8025, name: "ui")
.WithEndpoint(port: 1025, targetPort: 1025, name: "smtp");
// Reference in your API project
var api = builder.AddProject<Projects.MyApp_Api>("api")
.WithReference(mailpit.GetEndpoint("smtp"))
.WithEnvironment("Smtp__Host", mailpit.GetEndpoint("smtp"));
builder.Build().Run();
SMTP Configuration
appsettings.json
{
"Smtp": {
"Host": "localhost",
"Port": 1025,
"EnableSsl": false,
"FromAddress": "noreply@myapp.com",
"FromName": "MyApp"
}
}


