Announcing the .NET SDK

Integrate email into your .NET apps using the new Resend SDK.

Filipe ToscanoFilipe Toscano

We believe strongly in the importance of native SDKs. Developers should be able to write in their preferred language using more than a simple REST wrapper. SDKs should feel, look, and act like the languages.

Today we're excited to announce our official .NET SDK, which expands our SDK support to yet another group of developers.

With Resend's .NET SDK, you can now make email sending an easy step in your workflow no matter what type of application or website you're building.

Getting started

You can install the SDK using the CLI:

dotnet add package Resend

Or install the SDK using Visual Studio (Package Manager Console):

PM> Install-Package Resend

In the startup of your application, configure the DI container:

using Resend;
builder.Services.AddOptions();
builder.Services.AddHttpClient<ResendClient>();
builder.Services.Configure<ResendClientOptions>( o =>
{
o.ApiToken = Environment.GetEnvironmentVariable( "RESEND_APITOKEN" )!;
} );
builder.Services.AddTransient<IResend, ResendClient>();

Finally, send an email using the injected IResend instance:

using Resend;
public class FeatureImplementation
{
private readonly IResend _resend;
public FeatureImplementation( IResend resend )
{
_resend = resend;
}
public Task Execute()
{
var message = new EmailMessage();
message.From = "you@example.com";
message.To.Add( "user@gmail.com" );
message.Subject = "hello world";
message.HtmlBody = "<strong>it works!</strong>";
await _resend.EmailSendAsync( message );
}
}

If you would like to learn more, check out the documentation.

We've also created several realistic examples (ASP .NET Controller API, Web, HTML rendering, Async sending, etc.) to help you integrate Resend into whatever .NET application you are building.