Headless LMS
Email

Resend

Send transactional email through Resend with the email-resend adapter.

@headless-lms/adapter-email-resend implements the EmailSender port with Resend. The server hands it fully rendered emails (subject, HTML, plain text) — rendering is the templates adapter's job.

Setup

  1. Create a Resend account and an API key.
  2. Verify your sending domain in Resend so you can send from your own address.
  3. Set the environment variables and inject the adapter.
main.ts
import { ResendEmailAdapter } from "@headless-lms/adapter-email-resend";

const container = await createContainer(config, {
  adapters: {
    email: new ResendEmailAdapter({
      apiKey: process.env.RESEND_API_KEY!,
      from: process.env.EMAIL_FROM ?? "onboarding@resend.dev",
    }),
  },
});

The adapter reads no environment itself — your installation parses env into a ResendEmailConfig and constructs it. In the reference installation, an unset RESEND_API_KEY means no adapter is injected and email sends fail loudly instead of silently dropping.

Environment variables

These are the variables the reference installation (apps/api) maps to the adapter's config:

VariableRequiredMaps toNotes
RESEND_API_KEYyesapiKeyUnset → no adapter injected; sends fail loudly.
EMAIL_FROMnofrome.g. Acme LMS <noreply@acme.com>, on a verified Resend domain. Defaults to onboarding@resend.dev.

Using a different provider

Implement the EmailSender port from @headless-lms/types — a single send(message) method — and pass your implementation in the email slot instead.

On this page