XpresMail.Sdk 1.0.0-beta

This is a prerelease version of XpresMail.Sdk.
dotnet add package XpresMail.Sdk --version 1.0.0-beta
                    
NuGet\Install-Package XpresMail.Sdk -Version 1.0.0-beta
                    
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="XpresMail.Sdk" Version="1.0.0-beta" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="XpresMail.Sdk" Version="1.0.0-beta" />
                    
Directory.Packages.props
<PackageReference Include="XpresMail.Sdk" />
                    
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 XpresMail.Sdk --version 1.0.0-beta
                    
#r "nuget: XpresMail.Sdk, 1.0.0-beta"
                    
#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 XpresMail.Sdk@1.0.0-beta
                    
#: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=XpresMail.Sdk&version=1.0.0-beta&prerelease
                    
Install as a Cake Addin
#tool nuget:?package=XpresMail.Sdk&version=1.0.0-beta&prerelease
                    
Install as a Cake Tool

XpresMail .NET SDK

The official .NET client for XpresMail, a self-hosted email delivery service. A clean fluent API for sending single, bulk, and scheduled emails; server-side templates; open/click tracking; attachments; CC/BCC; and per-send SMTP — with built-in resilience.

Targets net8.0 and netstandard2.0 (works on .NET Framework 4.6.1+).

✨ Features

  • Fluent builders — client.SendEmail().To(..).WithSubject(..).ExecuteAsync()
  • Clear exceptions — ValidationException (client-side), ApiException (HTTP), XpresMailException (network/base)
  • Sending: raw HTML/text, templates, bulk, scheduling, CC/BCC, attachments, BYO-SMTP
  • Template management: create / update / get / list / delete / preview
  • Resilience (Polly) on net8.0; automatic X-Correlation-Id propagation
  • Health-check integration (net8.0) + PingAsync()

💻 Installation

dotnet add package XpresMail.Sdk

⚙️ Configuration

using XpresMail.Sdk;

builder.Services.AddXpresMail(options =>
{
    options.BaseUrl = "https://mail.internal.company.com";
    options.ApiKey  = "xm_xxxxxxxxxxxxxxxxxxxx";
});

// or the short form:
builder.Services.AddXpresMail("https://mail.internal.company.com", "xm_xxxx");

Inject IXpresMailClient anywhere.

🚀 Quickstart

public class WelcomeService(IXpresMailClient mail)
{
    public async Task SendAsync(string to)
    {
        try
        {
            var result = await mail.SendEmail()
                .To(to)
                .WithSubject("Welcome 👋")
                .WithBody("<h1>Hello!</h1>")
                .ExecuteAsync();

            // result.EmailId — track status later.
        }
        catch (ValidationException ex)   { /* bad input before sending */ }
        catch (ApiException ex)          { /* ex.StatusCode, ex.Message */ }
        catch (XpresMailException ex)    { /* network/timeout */ }
    }
}

📨 Sending

// Template + data
await mail.SendEmail()
    .To("kwame@example.com")
    .UseTemplate("welcome", new Dictionary<string, object?> { ["name"] = "Kwame" })
    .ExecuteAsync();

// Attachments, CC/BCC, scheduling
await mail.SendEmail()
    .To("a@b.com").Cc("mgr@b.com").Bcc("audit@b.com")
    .WithSubject("Invoice").WithBody("<p>See attached</p>")
    .AttachFile("invoice.pdf")
    .ScheduleAt(DateTime.UtcNow.AddHours(2))
    .ExecuteAsync();

// Bring your own SMTP
await mail.SendEmail()
    .To("customer@example.com").From("billing@myapp.com")
    .WithSubject("Receipt").WithBody("...")
    .UseSmtp("smtp.myapp.com", port: 465, useSsl: true, user: "billing@myapp.com", password: "••••")
    .ExecuteAsync();

// Bulk with per-recipient data
await mail.SendBulk()
    .UseTemplate("newsletter")
    .AddRecipient("a@x.com", new Dictionary<string, object?> { ["name"] = "Ama" })
    .AddRecipient("b@x.com", new Dictionary<string, object?> { ["name"] = "Kojo" })
    .ExecuteAsync();

🔎 Status, events, list, resend

var status = await mail.GetEmailStatus().WithId(id).ExecuteAsync();
var events = await mail.GetEmailEvents().WithId(id).ExecuteAsync();
var page   = await mail.ListEmails().WithStatus("Failed").WithPage(1).ExecuteAsync();
await mail.ResendEmail().WithId(id).ExecuteAsync();

🧩 Templates

await mail.CreateTemplate().Named("welcome")
    .WithSubject("Welcome, {{ name }}!").WithBody("<h1>Hello {{ name }}</h1>")
    .ExecuteAsync();

var preview = await mail.PreviewTemplate().Named("welcome")
    .WithData("name", "Kwame").ExecuteAsync();

var all = await mail.ListTemplates().ExecuteAsync();
await mail.DeleteTemplate().Named("welcome").ExecuteAsync();

✅ Error handling

Exception When
ValidationException invalid input caught before the request (has ParamName)
ApiException the API returned a non-success status (StatusCode, ResponseContent)
XpresMailException base type; also network errors / timeouts

❤️ Health checks (net8.0)

builder.Services.AddHealthChecks().AddXpresMail();
bool up = await mail.PingAsync();

📜 License

MIT.

Product Compatible and additional computed target framework versions.
.NET net5.0 was computed.  net5.0-windows was computed.  net6.0 was computed.  net6.0-android was computed.  net6.0-ios was computed.  net6.0-maccatalyst was computed.  net6.0-macos was computed.  net6.0-tvos was computed.  net6.0-windows was computed.  net7.0 was computed.  net7.0-android was computed.  net7.0-ios was computed.  net7.0-maccatalyst was computed.  net7.0-macos was computed.  net7.0-tvos was computed.  net7.0-windows was computed.  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 was computed.  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 was computed.  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. 
.NET Core netcoreapp2.0 was computed.  netcoreapp2.1 was computed.  netcoreapp2.2 was computed.  netcoreapp3.0 was computed.  netcoreapp3.1 was computed. 
.NET Standard netstandard2.0 is compatible.  netstandard2.1 was computed. 
.NET Framework net461 was computed.  net462 was computed.  net463 was computed.  net47 was computed.  net471 was computed.  net472 was computed.  net48 was computed.  net481 was computed. 
MonoAndroid monoandroid was computed. 
MonoMac monomac was computed. 
MonoTouch monotouch was computed. 
Tizen tizen40 was computed.  tizen60 was computed. 
Xamarin.iOS xamarinios was computed. 
Xamarin.Mac xamarinmac was computed. 
Xamarin.TVOS xamarintvos was computed. 
Xamarin.WatchOS xamarinwatchos 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
1.0.0-beta 79 6/28/2026