The official C# SDK for the Mailinator API. This package is a thin, asynchronous wrapper around the Mailinator REST API, and the Mailinator OpenAPI specification is the source of truth for documented endpoints.
The SDK targets .NET Framework 4.7.1 and .NET Standard 2.0.
Install the MailinatorApiClient package from NuGet:
dotnet add package MailinatorApiClientPackage Manager Console:
Install-Package MailinatorApiClientPackageReference:
<PackageReference Include="MailinatorApiClient" Version="YOUR_VERSION" />Create a Mailinator account, then obtain an API token from Team Settings > API Tokens. Keep the token outside your source code—for example, in an environment variable.
using System;
using mailinator_csharp_client;
using mailinator_csharp_client.Models.Messages.Entities;
using mailinator_csharp_client.Models.Messages.Requests;
var apiToken = Environment.GetEnvironmentVariable("MAILINATOR_API_TOKEN");
if (string.IsNullOrEmpty(apiToken))
{
throw new InvalidOperationException("Set MAILINATOR_API_TOKEN before running this example.");
}
var client = new MailinatorClient(apiToken);
var response = await client.MessagesClient.FetchInboxAsync(
new FetchInboxRequest
{
Domain = "your-private-domain.com",
Inbox = "your-inbox",
Skip = 0,
Limit = 20,
Sort = Sort.desc
});All API operations are asynchronous and end in Async. Operations are grouped under MessagesClient, DomainsClient, AuthenticatorsClient, StatsClient, WebhooksClient, and RulesClient.
- Mailinator API reference describes the REST API.
- REFERENCE.md lists the operations currently exposed by this SDK.
- EXAMPLES.md contains examples for common SDK workflows.
Construct MailinatorClient with an API token for messages, domains, authenticators, stats, and rules:
var client = new MailinatorClient(apiToken);Webhook injection uses a webhook token in the request URL and does not use an API token. The parameterless client constructor initializes WebhooksClient for these calls:
var webhookClient = new MailinatorClient();See the webhook examples for complete requests.
Some older SDK operations do not appear in the current OpenAPI specification. They remain available for compatibility but are marked with [Obsolete] and may be removed in a future major release. See the deprecation notes in REFERENCE.md and the alignment work in ROADMAP.md.
Build the solution when the installed .NET SDK supports all target frameworks:
dotnet build mailinator-csharp-client.slnRun the fast, offline unit tests:
dotnet test mailinator-csharp-client-unit-tests/mailinator-csharp-client-unit-tests.csprojThe separate legacy integration suite calls the live Mailinator API and requires deliberate account configuration. Some tests create or delete remote resources. Read TESTING.md before running it.
To compare the SDK request surface with the OpenAPI specification, use the OpenAPI coverage check.