CommunityToolkit.Aspire.Posta 13.6.1

Prefix Reserved
There is a newer prerelease version of this package available.
See the version list below for details.
dotnet add package CommunityToolkit.Aspire.Posta --version 13.6.1
                    
NuGet\Install-Package CommunityToolkit.Aspire.Posta -Version 13.6.1
                    
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="CommunityToolkit.Aspire.Posta" Version="13.6.1" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="CommunityToolkit.Aspire.Posta" Version="13.6.1" />
                    
Directory.Packages.props
<PackageReference Include="CommunityToolkit.Aspire.Posta" />
                    
Project file
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add CommunityToolkit.Aspire.Posta --version 13.6.1
                    
#r "nuget: CommunityToolkit.Aspire.Posta, 13.6.1"
                    
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
#:package CommunityToolkit.Aspire.Posta@13.6.1
                    
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=CommunityToolkit.Aspire.Posta&version=13.6.1
                    
Install as a Cake Addin
#tool nuget:?package=CommunityToolkit.Aspire.Posta&version=13.6.1
                    
Install as a Cake Tool

Posta client integration

Use this integration to call the Posta HTTP API through an HttpClient configured with Aspire service discovery.

Getting started

dotnet add package CommunityToolkit.Aspire.Posta

Register the client in the consuming project:

builder.AddPostaClient("posta", settings =>
{
    settings.ApiKey = builder.Configuration["Posta:ApiKey"];
});

The hosting resource exposes an Endpoint=... connection string, so an AppHost can use .WithReference(posta).

Calling an API section

The client intentionally covers the application-facing email, template, subscriber-list, health, and information APIs. These areas are exposed through separate interfaces.

using CommunityToolkit.Aspire.Posta.Models.Emails;
using CommunityToolkit.Aspire.Posta.Clients;

public sealed class MailService(IPostaClient posta)
{
    public Task<SendAnEmailResponse?> SendAsync(CancellationToken cancellationToken) =>
        posta.Emails.SendAnEmailAsync(
            new SendAnEmailRequest
            {
                From = "Acme <hello@example.com>",
                To = ["user@example.com"],
                Subject = "Hello",
                Html = "<h1>Hello!</h1>"
            },
            cancellationToken);
}

Path and query parameters are supplied separately and are escaped by the client:

await posta.Emails.GetEmailDetailsAsync(
    new GetEmailDetailsRequest
    {
        Id = emailId
    },
    cancellationToken);

API-key and JWT operations select the appropriate configured credential automatically. A dynamic application-wide implementation can replace CommunityToolkit.Aspire.Posta.Configuration.IPostaCredentialProvider in DI.

For multiple Posta instances, register keyed clients with AddKeyedPostaClient(...) and resolve them through GetRequiredKeyedService<IPostaClient>(key).

Request and response models

Models are grouped by API area under CommunityToolkit.Aspire.Posta.Models, for example Models.Emails, Models.Templates, and Models.SubscriberLists. Reusable nested schemas are under Models.Shared. JSON property names, required members, path parameters, and query parameters follow Posta's OpenAPI document.

Administrative, OAuth, workspace-management, analytics, campaign, and other uncommon APIs are not duplicated in this package. They can still be called through IPostaSectionClient.SendAsync<TResponse> with a custom PostaEndpoint and PostaRequest.

Overriding endpoints

Paths are not embedded in the section clients. Replace IPostaEndpoints, or derive from PostaEndpoints and override only the changed operation:

public sealed class CustomPostaEndpoints : PostaEndpoints
{
    public override PostaEndpoint SendAnEmail { get; } =
        new(HttpMethod.Post, "/custom/v1/emails/send", PostaAuthentication.ApiKey);
}

builder.Services.AddSingleton<IPostaEndpoints, CustomPostaEndpoints>();

Additional documentation

Feedback & contributing

Submit issues and pull requests through the CommunityToolkit.Aspire repository.

Product Compatible and additional computed target framework versions.
.NET net8.0 is compatible.  net8.0-android was computed.  net8.0-browser was computed.  net8.0-ios was computed.  net8.0-maccatalyst was computed.  net8.0-macos was computed.  net8.0-tvos was computed.  net8.0-windows was computed.  net9.0 is compatible.  net9.0-android was computed.  net9.0-browser was computed.  net9.0-ios was computed.  net9.0-maccatalyst was computed.  net9.0-macos was computed.  net9.0-tvos was computed.  net9.0-windows was computed.  net10.0 is compatible.  net10.0-android was computed.  net10.0-browser was computed.  net10.0-ios was computed.  net10.0-maccatalyst was computed.  net10.0-macos was computed.  net10.0-tvos was computed.  net10.0-windows was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
13.6.2-beta.959 41 10/27/2026
13.6.1 87 10/26/2026
13.6.1-beta.950 47 10/26/2026
13.6.1-beta.938 54 10/24/2026
13.6.1-beta.935 56 10/15/2026
13.6.1-beta.933 56 10/13/2026
13.6.1-beta.930 54 10/11/2026
13.6.0 123 10/1/2026
13.6.0-beta.914 57 10/1/2026
13.6.0-beta.910 60 9/30/2026
13.5.1-beta.895 64 9/29/2026
13.5.1-beta.806 63 9/28/2026
13.5.1-beta.803 58 9/28/2026
13.5.1-beta.781 56 9/28/2026
13.5.1-beta.779 64 9/28/2026
13.5.1-beta.777 62 9/28/2026
13.5.1-beta.776 60 9/28/2026
13.5.1-beta.775 60 9/27/2026
13.5.1-beta.770 60 9/25/2026
13.5.1-beta.767 62 9/22/2026
Loading failed