Documentation

SDKs / NuGet

.NET email API SDK

Idiomatic async SDK for .NET with DI support. .NET 8 or newer.

Install

dotnet add package MailStack

NuGet package ↗ Source on GitHub ↗

Quickstart

Send your first email — create an API key in the dashboard, then:

using MailStack;

var client = new MailStackClient("ms_live_xxxxxxxxxxxx");

var res = await client.Emails.SendAsync(new SendEmailRequest
{
    From = "hello@yourdomain.com",
    To = "user@example.com",
    Subject = "Welcome to MailStack",
    Html = "<h1>Hi there 👋</h1>",
});

Console.WriteLine($"{res.Id} {res.Status}");

The send API is authenticated with your ms_live_ key. For dashboard resources (domains, templates, webhooks) pass your organization id too — see the REST API reference.

Verifying webhooks

Verify incoming webhook deliveries against the raw request body. The signature is an HMAC-SHA256 over {timestamp}.{body} carried in the MailStack-Signature header:

using MailStack;

bool ok = WebhookSignature.Verify(
    secret: webhookSecret,
    payload: rawBody, // RAW request body string
    signatureHeader: Request.Headers["MailStack-Signature"]);

What's included

  • Async/await across every resource
  • Records for requests/responses, typed enums
  • AddMailStack() dependency-injection extension
  • Webhook signature verification helper
  • Single, batch, bulk, scheduled, and lint sends

Next steps

Browse the full REST API reference, read the quickstart, or compare the other official SDKs.