Skip to the documentation
C#

Helpers and constants

What else the package defines besides the client’s methods.

Helpers

HelperWhat it is
new OpenEmailClient()A client. It reads the environment for anything you leave out, and throws ArgumentException for a configuration it refuses.
OpenEmailClient.CreateTempMail()A client for disposable inboxes that carries no API key.
OpenEmailClient.VerifyWebhookSignature()Checks the signature of a delivery in constant time, with a five minute window that toleranceSeconds: changes, and returns the event.
OpenEmailClient.IsApiKey(), OpenEmailClient.IsAccessToken()Whether a value has the shape of an API key or of an access token.
OpenEmailClient.IsSealed()Whether a message is end to end encrypted, so its body cannot be read by the API.
OpenEmailClient.ResolveLanguage(), OpenEmailClient.LanguageByCode(), OpenEmailClient.IsRtlLanguage()Look a language up by code, English name or own name, in the table Languages.All holds.
OpenEmailClient.ToBase64(), OpenEmailClient.ToBase64Async()Encode a byte[] or a Stream as base64, for a field that takes base64 text.
client.Raw.RequestAsync()Calls a path no method wraps yet, with the credential and retry policy of the client.

Types

TypeWhat it is
BodyA request body: a dictionary with the field names of the API, sent in the order its keys were added.
JsonObjectA decoded response, from System.Text.Json.Nodes. Read a field with sent["id"], and cast it with (string?)sent["id"].
PageOne page of a list: Items, HasMore and NextCursor.
BatchResult, TemplateSends, PeoplePage, TempMessagesPage, AddressBook, AddressBookPageThe answers that hold more than a list, such as the Sent and Failed counts of a batch.
OpenEmailApiException, OpenEmailNetworkException, OpenEmailWebhookExceptionWhat the client throws. All three derive from OpenEmailException.

Constants

The OpenEmail.Constants namespace holds every set of values the API uses, generated from the TypeScript SDK: webhook events, scopes, statuses and the rest. Each set is a static class whose members are constants, and Values lists them all.

constants.cs
using OpenEmail.Constants; var webhook = await client.Webhooks.CreateAsync(new Body{    ["url"] = "https://example.com/webhooks/openemail",    ["events"] = new[] { WebhookEvents.EmailReceived, WebhookEvents.EmailBounced },}); Console.WriteLine($"{webhook["id"]} {WebhookEvents.Values.Count}");