İçeriğe geç

Get started with the Mailpit integrations

Bu içerik henüz dilinizde mevcut değil.

⭐ Community Toolkit Mailpit logo

Mailpit is an email testing tool for developers. It acts as an SMTP server, captures emails, and provides a web interface to view them. The Aspire Mailpit hosting integration enables you to run Mailpit alongside your Aspire projects for local email testing.

In this introduction, you’ll see how to install and use the Aspire Mailpit hosting integration in a simple configuration. If you already have this knowledge, see Mailpit hosting integration for full reference details.

To begin, install the Aspire Mailpit hosting integration in your Aspire AppHost project:

Aspire CLI — CommunityToolkit.Aspire.Hosting.MailPit paketi ekle
aspire add communitytoolkit-mailpit

Aspire CLI etkileşimlidir; istendiğinde uygun sonucu seçin:

Aspire CLI — Örnek çıktı
Select an integration to add:
> communitytoolkit-mailpit (CommunityToolkit.Aspire.Hosting.MailPit)
> Other results listed as selectable options...

Next, in the AppHost project, add a Mailpit resource and pass it to your consuming projects:

C# — AppHost.cs
var builder = DistributedApplication.CreateBuilder(args);
var mailpit = builder.AddMailPit("mailpit");
builder.AddProject<Projects.ExampleProject>()
.WithReference(mailpit);
// After adding all resources, run the app...

Mailpit doesn’t require a dedicated client integration package. You can use any SMTP library to send emails to Mailpit. See the Mailpit client integration page for examples using MailKit and System.Net.Mail.

For full reference details, see Mailpit hosting integration and Mailpit client integration.