MailinatorApiClient 2.0.0
dotnet add package MailinatorApiClient --version 2.0.0
NuGet\Install-Package MailinatorApiClient -Version 2.0.0
<PackageReference Include="MailinatorApiClient" Version="2.0.0" />
<PackageVersion Include="MailinatorApiClient" Version="2.0.0" />
<PackageReference Include="MailinatorApiClient" />
paket add MailinatorApiClient --version 2.0.0
#r "nuget: MailinatorApiClient, 2.0.0"
#:package MailinatorApiClient@2.0.0
#addin nuget:?package=MailinatorApiClient&version=2.0.0
#tool nuget:?package=MailinatorApiClient&version=2.0.0
Mailinator C# SDK
The official Mailinator C# SDK. 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.
Installation
Install the MailinatorApiClient package from NuGet:
dotnet add package MailinatorApiClient
Package Manager Console:
Install-Package MailinatorApiClient
PackageReference:
<PackageReference Include="MailinatorApiClient" Version="YOUR_VERSION" />
Upgrading from 1.0.7 to 2.0.0
Version 2.0.0 upgrades RestSharp from 112.0.0 to 114.0.0. RestSharp types are part of this SDK's public API, including IHttpClient and DynamicJsonSerializer, so consumers must account for RestSharp's breaking changes:
- Align any direct RestSharp references with 114.0.0 and rebuild consuming applications and libraries.
- If you implement RestSharp's
IAuthenticator, updateAuthenticateto accept the optionalCancellationTokenparameter. - If you access
ReadOnlyRestClientOptions.FollowRedirectsorMaxRedirects, migrate toRedirectOptions. - Recompile code using RestSharp's generic parameter extension methods, whose signatures now include an optional culture parameter.
See the RestSharp 114 changelog for details. The SDK continues to target .NET Framework 4.7.1 and .NET Standard 2.0.
Message listing now sends the documented ascending and descending sort query values. Continue using Sort.asc and Sort.desc in C#.
Quick start
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.
For complete workflows, including domain message listing, message content, headers, attachments, and webhooks, see EXAMPLES.md.
Documentation
- Mailinator API reference describes the REST API.
- EXAMPLES.md contains examples for common SDK workflows.
Authentication
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.
Deprecated APIs
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 compatibility decisions in ROADMAP.md.
Development
Build the solution when the installed .NET SDK supports all target frameworks:
dotnet build mailinator-csharp-client.sln
Run the fast, offline unit tests:
dotnet test mailinator-csharp-client-unit-tests/mailinator-csharp-client-unit-tests.csproj
The 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.
Maintainers should follow RELEASING.md to publish NuGet packages and matching GitHub Releases.
| Product | Versions 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 was computed. 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 is compatible. 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. |
-
.NETFramework 4.7.1
- Newtonsoft.Json (>= 13.0.4)
- RestSharp (>= 114.0.0)
- System.Text.Json (>= 10.0.12)
-
.NETStandard 2.0
- Newtonsoft.Json (>= 13.0.4)
- RestSharp (>= 114.0.0)
- System.Text.Json (>= 10.0.12)
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.