[.NET SDK]
ASP.NET Core
Send email from ASP.NET Core minimal APIs and controllers with the .NET SDK.
Step 1
Install the package
Add the official .NET client to your ASP.NET Core project.
bash
dotnet add package Reloop.EmailStep 2
Set your API key
Create a free Reloop account, copy your API key, and add it to your ASP.NET Core environment.
Get an API key free โbash
RELOOP_API_KEY="re_xxxxxxxx"Step 3
Send email from ASP.NET Core
Use this ASP.NET Core snippet to send your first message. Works with Minimal APIs ยท Controllers.
send_email.cs
1using Reloop.Email;2
3var builder = WebApplication.CreateBuilder(args);4var app = builder.Build();5
6var reloop = ReloopEmail.Client(7 Environment.GetEnvironmentVariable("RELOOP_API_KEY"));8
9app.MapPost("/send", async (SendRequest req) =>10{11 var email = await reloop.Emails.SendAsync(new SendEmailRequest12 {13 From = "Acme <onboarding@yourdomain.com>",14 To = new[] { req.To },15 Subject = "Hello from ASP.NET",16 Html = "<strong>It works!</strong>"17 });18
19 return Results.Ok(new { id = email.Id });20});21
22app.Run();23
24record SendRequest(string To);Next steps
Examples, docs, and API reference
Go deeper with working code and the full API for .NET.
Send with ASP.NET Core.
Get an API key and ship transactional email from ASP.NET Core using the official .NET SDK.