UseSend 1.4.0
See the version list below for details.
dotnet add package UseSend --version 1.4.0
NuGet\Install-Package UseSend -Version 1.4.0
<PackageReference Include="UseSend" Version="1.4.0" />
<PackageVersion Include="UseSend" Version="1.4.0" />
<PackageReference Include="UseSend" />
paket add UseSend --version 1.4.0
#r "nuget: UseSend, 1.4.0"
#:package UseSend@1.4.0
#addin nuget:?package=UseSend&version=1.4.0
#tool nuget:?package=UseSend&version=1.4.0
useSend .NET SDK
.NET client for the useSend email API. useSend is an open-source alternative to Resend, SendGrid, Mailgun and Postmark.
Installation
dotnet add package UseSend
Quick Start
With Dependency Injection (ASP.NET Core)
// Program.cs
builder.Services.AddUseSend("us_your_api_token");
// In your service/controller — inject IUseSend or a specific service interface
public class WelcomeSender(IUseSend useSend)
{
public async Task SendWelcomeAsync(string to)
{
var response = await useSend.Emails.SendAsync(new EmailMessage
{
From = "noreply@yourdomain.com",
To = to,
Subject = "Welcome!",
Html = "<h1>Welcome aboard!</h1>",
});
if (response.Success)
Console.WriteLine($"Email sent: {response.Content}");
}
}
// Or inject only the service interface you need
public class DomainChecker(IEmailService emails, IDomainService domains) { ... }
Self-Hosted useSend
builder.Services.AddUseSend(options =>
{
options.ApiToken = "us_your_api_token";
options.ApiUrl = "https://send.mycompany.com/api/"; // your self-hosted instance
});
Without Dependency Injection
var client = UseSendClient.Create("us_your_api_token");
var response = await client.Emails.SendAsync(new EmailMessage
{
From = "noreply@yourdomain.com",
To = "user@example.com",
Subject = "Hello",
Text = "Hello from useSend!",
});
Environment Variable
If you prefer not to hardcode your token, set the USESEND_API_KEY environment variable and create the client with no
arguments:
var client = UseSendClient.Create(); // reads USESEND_API_KEY
Features
| Resource | Operations |
|---|---|
| Emails | Send, Batch send (both with idempotency), Get, List, Cancel schedule, Update schedule |
| Domains | List, Create, Get, Delete, Verify |
| Contacts | Create, Get, List, Update, Upsert, Delete, Bulk create, Bulk delete |
| Contact Books | List, Create, Get, Update, Delete |
| Campaigns | Create, Get, List, Delete, Schedule, Pause, Resume |
| Analytics | Email time series, Reputation metrics |
Examples
- ConsoleNoDi — Standalone usage without dependency injection
- WebMinimalApi — ASP.NET Core minimal API with DI
- ConsoleSelfHosted — Custom host URL for self-hosted useSend
- WebIdentity — ASP.NET Core Identity with email confirmation and password reset
Authentication
All API calls require a Bearer token. Create one in your useSend Developer Settings.
Error Handling
By default, failed API calls throw a UseSendException. To receive errors as return values instead:
builder.Services.AddUseSend(options =>
{
options.ApiToken = "us_your_api_token";
options.ThrowExceptions = false;
});
var response = await useSend.Emails.SendAsync(email);
if (!response.Success)
Console.WriteLine($"Error {response.Exception!.StatusCode}: {response.Exception.ApiError}");
API Reference
Full API documentation: docs.usesend.com/api-reference
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | net8.0 is compatible. 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 is compatible. 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. |
-
net10.0
- Microsoft.AspNetCore.WebUtilities (>= 10.0.8)
- Microsoft.Extensions.Http (>= 10.0.8)
- Microsoft.Extensions.Options (>= 10.0.8)
-
net8.0
- Microsoft.AspNetCore.WebUtilities (>= 8.0.0)
- Microsoft.Extensions.Http (>= 8.0.0)
- Microsoft.Extensions.Options (>= 8.0.0)
NuGet packages (5)
Showing the top 5 NuGet packages that depend on UseSend:
| Package | Downloads |
|---|---|
|
UseSend.FluentEmail
.NET client for useSend mail API |
|
|
UseSend.Razor
.NET client for useSend mail API |
|
|
UseSend.Fluid
.NET client for useSend mail API |
|
|
UseSend.OpenTelemetry
.NET client for useSend mail API |
|
|
UseSend.Identity
.NET client for useSend mail API |
GitHub repositories
This package is not used by any popular GitHub repositories.