Get started with Papercut SMTP integration
Ce contenu n’est pas encore disponible dans votre langue.
⭐ Community Toolkit

Terminal
apphost.mts AppHost.cs
Papercut SMTP captures email sent by an application and provides a web console for inspecting messages. Use the Community Toolkit integration to run it alongside your app during development and testing.
Prerequisites
Section titled “Prerequisites”- An Aspire AppHost project
- An application that can send mail through an SMTP server
Add Papercut SMTP to your AppHost
Section titled “Add Papercut SMTP to your AppHost”Install the 📦 CommunityToolkit.Aspire.Hosting.PapercutSmtp package in the AppHost:
aspire add CommunityToolkit.Aspire.Hosting.PapercutSmtpAdd the resource and reference it from the application that sends email. See Set up Papercut SMTP in the AppHost for port configuration and connection details.
import { createBuilder } from './.aspire/modules/aspire.mjs';
const builder = await createBuilder();const papercut = await builder.addPapercutSmtp('papercut');const mailer = await builder.addProject('mailer', '../Mailer/Mailer.csproj');await mailer.withReference(papercut);await mailer.waitFor(papercut);
await builder.build().run();var builder = DistributedApplication.CreateBuilder(args);var papercut = builder.AddPapercutSmtp("papercut");
builder.AddProject<Projects.Mailer>("mailer") .WithReference(papercut) .WaitFor(papercut);
// After adding all resources, run the app...builder.Build().Run();