Learn how to send your first email using the Resend .NET SDK.
dotnet add package Resend
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>();
IResend
using Resend; public class FeatureImplementation { private readonly IResend _resend; public FeatureImplementation( IResend resend ) { _resend = resend; } public Task Execute() { var message = new EmailMessage(); message.From = "Acme <onboarding@resend.dev>"; message.To.Add( "delivered@resend.dev" ); message.Subject = "hello world"; message.HtmlBody = "<strong>it works!</strong>"; await _resend.EmailSendAsync( message ); } }
Was this page helpful?