Email · Resend
Email · Resend
Implements barakoCMS's IEmailService using the Resend HTTP API, so features
that send email (password-reset, passwordless OTP sign-in, workflow emails) deliver for real instead
of hitting the built-in mock.
A workflow email that names attachments is posted with them; see docs/configuring-email.md in the
repository.
Enable it
dotnet add package BarakoCMS.Email.Resend
builder.Services.AddBarakoCMS(builder.Configuration);
var app = builder.Build();
app.UseBarakoCMS();
The package reference plus a restart is the install. AddBarakoCMS finds every module in the
application's dependency context, and BarakoCMS:Modules:Enabled decides which of them run
(BarakoCMS__Modules__Enabled=Email.Resend). Unset, every referenced module runs and the API logs
one warning saying so. To name it by hand instead, put
modules.Add(new BarakoCMS.Email.Resend.ResendEmailModule())
in the AddBarakoCMS callback; discovery skips a type the host already added. See MODULES.md in
the repository.
barakoCMS registers its mock email service with TryAdd, so this module's registration wins.
Configure
| Setting | Description |
|---|---|
Resend:ApiKey (or RESEND_API_KEY env) |
Your Resend API key (re_…). Keep it in user-secrets / env, never in source. |
Resend:From |
Sender, e.g. MyApp <no-reply@yourdomain.com>. Defaults to Resend's shared test sender. |
To send to arbitrary recipients, verify your domain in the Resend dashboard and set Resend:From
to an address on it. (The shared onboarding@resend.dev sender only delivers to your own account
email.)
Failures
A send Resend cannot have taken throws EmailNotSentException: a name not resolved, a connection
not opened, a failed TLS handshake, or a 429 or 503 answer. A workflow email tries again inside the
attempt on that exception. Any other status throws InvalidOperationException, and a timeout or a
connection lost after the request went is not caught here, so neither is resent.
Requires
barakoCMS and BarakoCMS.Abstractions, at the versions NuGet lists as this package's dependencies. Neither is older than 4.3.0, the release that added BarakoCMS.Abstractions. Targets .NET 10.
License
MIT © BaryoDev
If barakoCMS is useful to you, a star on the repository helps other people find it.