Skip to content
DocsTry Aspire
DocsTry

Get started with the Mailpit integrations

⭐ Community Toolkit Mailpit logo

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.

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/mailpit container 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.
  • Built-in health checks. The hosting integration checks Mailpit’s /livez and /readyz endpoints so the dashboard can report when the resource is ready.
  • 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.

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 string or individual connection properties that Aspire injects and use a 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.

  1. 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 the SMTP and HTTP endpoints, persistent storage, port configuration, and health checks.

    Set up Mailpit in the AppHost

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