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 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.
Set up hosting integration
Section titled “Set up hosting integration”To begin, install the Aspire Mailpit hosting integration in your Aspire AppHost project:
aspire add communitytoolkit-mailpitLa CLI de Aspire es interactiva; asegúrate de seleccionar el resultado adecuado cuando se te pida:
Select an integration to add:
> communitytoolkit-mailpit (CommunityToolkit.Aspire.Hosting.MailPit)> Other results listed as selectable options...#:package CommunityToolkit.Aspire.Hosting.MailPit@*<PackageReference Include="CommunityToolkit.Aspire.Hosting.MailPit" Version="*" />Next, in the AppHost project, add a Mailpit resource and pass it to your consuming projects:
var builder = DistributedApplication.CreateBuilder(args);
var mailpit = builder.AddMailPit("mailpit");
builder.AddProject<Projects.ExampleProject>() .WithReference(mailpit);
// After adding all resources, run the app...Sending emails to Mailpit
Section titled “Sending emails to Mailpit”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.