Notix
Integrations

Send email from .NET with HttpClient.

A .NET app sends through Notix with the HttpClient it already has. Register one through IHttpClientFactory in ASP.NET Core, set the bearer key from configuration, and post the message as JSON with an idempotency key.

The send

Send an email from .NET.

C#
using System.Net.Http.Headers;
using System.Net.Http.Json;

var http = new HttpClient { Timeout = TimeSpan.FromSeconds(10) };
http.DefaultRequestHeaders.Authorization =
    new AuthenticationHeaderValue("Bearer", Environment.GetEnvironmentVariable("NOTIX_API_KEY"));

using var request = new HttpRequestMessage(HttpMethod.Post, "https://app.usenotix.dev/api/v1/emails")
{
    Content = JsonContent.Create(new
    {
        from = "Acme <receipts@acme.com>",
        to = "maria@example.com",
        subject = "Your receipt",
        html = "<p>Thanks for your order.</p>",
    }),
};
request.Headers.Add("Idempotency-Key", "order-4471-receipt");

var response = await http.SendAsync(request);
response.EnsureSuccessStatusCode();

The from address must be on a domain you have verified in Notix. Step by step: the cURL quickstart and the longer guide to sending email from .NET.

Environment

One API key, kept on the server.

Create an API key on the API keys page of the Notix console and store it as NOTIX_API_KEY in user secrets in development and the host's environment in production. Read it only in code that runs on the server, never in anything shipped to a browser.

A Send only key is enough for code that only sends: if it leaks, it cannot read your contacts or delete a domain.

.env
NOTIX_API_KEY=notix_xxxxxxxxxxxx
NOTIX_WEBHOOK_SECRET=whsec_xxxxxxxxxxxx
Webhooks

Verify the signature with HMACSHA256.

Without an SDK, compute v1= plus the hex HMAC-SHA256 of the X-Notix-Timestamp header, a dot and the raw body, with your signing secret; compare it with X-Notix-Signature in constant time and refuse a timestamp more than 5 minutes old.

In ASP.NET Core, read Request.Body into a string before any model binding touches it.

FAQ

Questions, answered.

Is there a Notix SDK for .NET?
No. Notix publishes SDKs for TypeScript, Python and PHP. From .NET the integration is the JSON API over HTTPS, or the SMTP relay, and both send through the same pipeline.
What if the same request runs twice?
Send an Idempotency-Key header (idempotencyKey in notix-js) with a value that names the thing being sent, such as order-4471-receipt. A repeat with the same key and body returns the first result and sends nothing new; the same key with a different body is refused with 409.
Why is my send refused with a from-address error?
The from address must be on a domain you have verified in Notix. Add the domain in the console, publish the DNS records it shows, and wait for verification; until then, sends from that domain are refused.

The free plan does not ask for a card.

Send your first email in five minutes.

Verify a domain, copy an API key, make one call. The free plan does not ask for a card.