Get started with the Mailpit integrations
Esta página aún no está disponible en tu idioma.
Mailpit is an email testing tool for developers. It acts as an SMTP server, captures outgoing emails, and exposes a web UI to inspect them. The Aspire Mailpit integration lets you model a Mailpit instance as a first-class resource in your AppHost, then hand the SMTP connection information to any consuming app — regardless of language.
Why use Mailpit with Aspire
Section titled “Why use Mailpit with Aspire”Adding Mailpit through Aspire — rather than wiring up containers and SMTP settings by hand — gives you:
- Zero-config local email testing. Aspire runs Mailpit from the
docker.io/axllent/mailpitcontainer image with endpoints configured automatically. - Consistent connection info across languages. Once you reference the Mailpit resource from a consuming app, Aspire injects SMTP connection properties as environment variables in a predictable format that works from C#, TypeScript, Python, Go, or any other language.
- Dashboard observability. The Mailpit resource shows up in the Aspire dashboard with logs and status alongside your other services.
- Built-in web UI. Mailpit’s web interface for inspecting captured emails is automatically accessible through the Aspire dashboard endpoint.
How the pieces fit together
Section titled “How the pieces fit together”Mailpit is a hosting-only integration — there is no separate client integration package. Your consuming apps connect to Mailpit directly using any standard SMTP library.
architecture-beta group apphost(server)[AppHost] group consumer(server)[Consuming app] service hosting(server)[Hosting integration] in apphost service mailpit(server)[Mailpit] in apphost service app(server)[App] in consumer hosting:R --> L:mailpit mailpit:R --> L:app
The hosting integration lives in your AppHost project and models the Mailpit instance as a resource. Your consuming apps read the SMTP connection properties that Aspire injects and use any standard SMTP library to send emails to Mailpit for inspection.
Getting there is a two-step process: model the Mailpit resource in your AppHost, then connect to it from each app that sends emails.
-
Model Mailpit in your AppHost
Section titled “Model Mailpit in your AppHost”Add the Mailpit hosting integration to your AppHost, then declare a Mailpit resource and reference it from the apps that need to send email. The Mailpit Hosting integration article walks through every capability — SMTP endpoint, HTTP UI endpoint, and data volumes.
Set up Mailpit in the AppHost
-
Connect from your consuming app
Section titled “Connect from your consuming app”When you reference a Mailpit resource from a consuming app, Aspire injects its SMTP connection information as environment variables. See Connect to Mailpit for the connection properties reference and per-language examples for C#, Go, Python, and TypeScript.
Connect to Mailpit