Skip to main content
The .NET SDK is the SendFlit NuGet package. It uses System.Text.Json and HttpClient, has no other dependencies, and targets .NET 6, 7 and 8.
Looking for another language? See the SDK overview.

Install

Create a client

The constructor takes these arguments: Client implements IDisposable. Dispose it when you’re done, or create one client and reuse it for the life of your app.

Send an email

SendAsync takes an Email and returns a SendResult.
Properties on Email: SendResult has Id, Status, and To.

Attachments

Use Attach. For text, pass a string. For binary data, pass a byte array and a content type. The SDK base64-encodes the content for you.
Limits:
  • Up to 10 attachments per message.
  • Up to 10 MB per attachment. Larger files are rejected with 422.

Send a batch

BatchAsync sends up to 100 emails in one request and returns a List<SendResult> in the same order as your input.
An empty list, or more than 100 emails, throws ArgumentException or ArgumentOutOfRangeException before any request is made. See Batch sending.
The .NET SDK doesn’t send an Idempotency-Key header yet, so a retried send can deliver twice. Check the earlier result before you retry. See Idempotency.

Manage emails

The .NET SDK can list emails. It doesn’t have methods to get or cancel a single email yet. Use GET /v1/emails/{id} or DELETE /v1/emails/{id} directly if you need them.

Domains

You can send only from a verified domain. For DNS setup, see Domains.

Suppressions

The second argument is optional and defaults to "unsubscribe". See Emails.

Usage

The .NET SDK doesn’t have a health method yet. Call GET /health directly if you need one.

Verify webhooks

SendFlit signs each webhook. The X-Sendflit-Signature header carries sha256=<hex>, an HMAC-SHA256 of the raw request body. Pass the raw bytes to the static method.
The comparison runs in constant time. See Webhooks for the event list.

Errors and retries

Failed calls throw SendFlitException, which has two properties:
Requests that fail with 429 or 5xx are retried up to maxRetries times. The SDK honors the Retry-After header when it’s present. Other 4xx responses are not retried. See Errors, retries and limits.

Method reference

Next steps