Get started with the Mailpit integrations
このコンテンツはまだ日本語訳がありません。
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-mailpitAspire CLI は対話的です。求められたら適切な結果を選択してください:
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.