ElasticEmail 4.3.0

There is a newer version of this package available.
See the version list below for details.
dotnet add package ElasticEmail --version 4.3.0
                    
NuGet\Install-Package ElasticEmail -Version 4.3.0
                    
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="ElasticEmail" Version="4.3.0" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="ElasticEmail" Version="4.3.0" />
                    
Directory.Packages.props
<PackageReference Include="ElasticEmail" />
                    
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 ElasticEmail --version 4.3.0
                    
#r "nuget: ElasticEmail, 4.3.0"
                    
#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 ElasticEmail@4.3.0
                    
#: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=ElasticEmail&version=4.3.0
                    
Install as a Cake Addin
#tool nuget:?package=ElasticEmail&version=4.3.0
                    
Install as a Cake Tool

Elastic Email C# SDK

The official .NET client for the Elastic Email REST API v4. Send transactional and marketing email, manage contacts, lists, templates, domains, webhooks and suppressions, and read delivery statistics.

Targets .NET Standard 2.0, so it runs on .NET 6/7/8+, .NET Framework 4.6.1+ and Mono.

Installation

dotnet add package ElasticEmail

Quick start

Elastic Email only sends from verified domains. Before your first send, verify your sending domain and use an address on that domain as the sender.

using ElasticEmail.Api;
using ElasticEmail.Client;
using ElasticEmail.Model;

var config = new Configuration();
config.BasePath = "https://api.elasticemail.com/v4";
config.ApiKey.Add("X-ElasticEmail-ApiKey", Environment.GetEnvironmentVariable("ELASTICEMAIL_API_KEY"));

var emails = new EmailsApi(config);

var message = new EmailTransactionalMessageData(
    recipients: new TransactionalRecipient(to: new List<string> { "john.doe@example.com" }),
    content: new EmailContent(
        from: "My App <no-reply@yourdomain.com>",
        subject: "Welcome aboard!",
        body: new List<BodyPart>
        {
            new BodyPart(BodyContentType.HTML, "<h1>Hello!</h1><p>Thanks for signing up.</p>"),
            new BodyPart(BodyContentType.PlainText, "Hello! Thanks for signing up.")
        }
    )
);

try
{
    EmailSend result = await emails.EmailsTransactionalPostAsync(message);
    Console.WriteLine($"Sent. TransactionID: {result.TransactionID}, MessageID: {result.MessageID}");
}
catch (ApiException e)
{
    Console.WriteLine($"Elastic Email API error {e.ErrorCode}: {e.Message}");
}

Keep your API key out of source code: load it from an environment variable, user secrets or a secrets manager. Create one in your API settings.

Signed webhooks

Webhooks can be signed with HMAC-SHA256 and delivered as POST + JSON. Both are chosen when the webhook is created:

var webhookApi = new WebhookApi(config);

var created = await webhookApi.WebhookPostAsync(new WebhookCreatePayload(
    name: "my-webhook",
    uRL: "https://your-app.example.com/webhook",
    notificationForSent: true,
    enableSigning: true,
    deliveryMethod: WebhookDeliveryMethod.PostJson));

// Returned only now - store it in your secret manager.
Console.WriteLine(created.SigningSecret);

Each request then carries X-ElasticEmail-Timestamp, X-ElasticEmail-Signature: v1=<hex> and X-ElasticEmail-Webhook-Id. To verify it, read the raw body before parsing it, reject timestamps more than 5 minutes off, compute hex(HMAC-SHA256(secret, "{timestamp}\n{METHOD}\n{raw path and query}\n{raw body}")) and compare it with every v1= entry in constant time. Return 401 on a mismatch; the event is retried. Rotate the secret with WebhookByPublicidSecretRotatePostAsync.

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 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 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
4.4.0 617 10/13/2026
4.3.0 79 10/13/2026
4.2.0 3,624 8/27/2026
4.0.30 126 8/26/2026
4.0.28 2,478 5/12/2026
4.0.27 2,763 3/12/2026
4.0.26 46,438 12/5/2024
4.0.24 15,831 7/5/2024
4.0.23 63,211 9/26/2023
4.0.22 19,243 12/13/2022
4.0.21 5,390 5/31/2022
4.0.19 8,561 3/15/2022
4.0.18 727 2/9/2022
4.0.17 11,703 2/9/2022
4.0.16 695 1/31/2022
4.0.15 559 11/10/2021
4.0.14 1,001 8/26/2021
4.0.13 566 8/26/2021
4.0.12 690 5/27/2021
4.0.11 572 5/25/2021
Loading failed

Release 4.3.0 - opt-in HMAC webhook signing and Rotate Webhook Secret endpoint