Skip to main content
net8.0net9.0

An Aspire component leveraging the MailPit container.

Published
Mar 3, 2025
1y ago
Total Downloads
408.1K
408,091

Install

dotnet add package CommunityToolkit.Aspire.Hosting.MailPit --version 9.2.1
ProductVersions
.NET
net8.0net9.0

README

CommunityToolkit.Hosting.MailPit

Overview

This .NET Aspire Integration runs MailPit in a container.

Usage

The MailPit integration exposes a connection string with the format endpoint=smtp://<host>:<port>. This connection string can be used to with a DbConnectionStringBuilder to get the smtp endpoint.

Example 1: Add MailPit with generated ports

var builder = DistributedApplication.CreateBuilder(args);

var mailpit = builder.AddMailPit("mailpit");

var xyz = builder.AddProject<Xyz>("application")
    .WithReference(mailpit)
    .WaitFor(mailpit);

builder.Build().Run();

Example 2: Add MailPit with user-defined ports

var builder = DistributedApplication.CreateBuilder(args);

var mailpit = builder.AddMailPit("mailpit", 80, 25);

var xyz = builder.AddProject<Xyz>("application")
    .WithReference(mailpit)
    .WaitFor(mailpit);

builder.Build().Run();

Changes from Previous Version

No structural changes between v9.2.1-beta.207 and v9.2.1.

Adoption Assessment

A verified publisher signal is available. Assess fit from the package's supported frameworks, license and dependency graph rather than popularity alone.

Compatibility metadata lists 2 target frameworks; confirm the exact target used by your application.

Related Guides & Workflows

Learn how to evaluate, integrate, or audit this package in your .NET project.