Skip to main content
net10.0net8.0net9.0

An Aspire component leveraging Papercut SMTP container.

Published
May 14, 2026
5mo ago
Total Downloads
64.6K
64,583

Install

dotnet add package CommunityToolkit.Aspire.Hosting.PapercutSmtp --version 13.3.0
ProductVersions
.NET
net10.0net8.0net9.0

README

CommunityToolkit.Hosting.PapercutStmp

Overview

This Aspire Integration runs Papercut SMTP in a container.

Usage

The Papercut SMTP 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 Papercut SMTP with generated ports

var builder = DistributedApplication.CreateBuilder(args);

var papercut = builder.AddPapercutSmtp("papercut");

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

builder.Build().Run();

Example 2: Add Papercut SMTP with user-defined ports

var builder = DistributedApplication.CreateBuilder(args);

var papercut = builder.AddPapercutSmtp("papercut", 80, 25);

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

builder.Build().Run();

Example 3: Get URI from connection-string using DbConnectionStringBuilder

string? papercutConnectionString = builder.Configuration.GetConnectionString("papercut");
DbConnectionStringBuilder connectionBuilder = new()
{
    ConnectionString = papercutConnectionString 
};

Uri endpoint = new(connectionBuilder["Endpoint"].ToString()!, UriKind.Absolute);
builder.Services.AddScoped(_ => new SmtpClient(endpoint.Host, endpoint.Port));

Changes from Previous Version

No structural changes between v13.2.1-beta.604 and v13.3.0.

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 3 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.