Resend

resendEmail34 lines

Transactional email with React-based templates and delivery webhooks.

Current — as published in v1.3.2. Written by hand for Resend, not generated.

The rule

Where it runs

  • Server-side only. The API key sends mail as your domain to any recipient. Never in the app, never in an EXPO_PUBLIC_* variable.

Sending

  • Check the returned error — the SDK returns { data, error } and does not throw. An unchecked error is indistinguishable from success.
  • Idempotency on any retryable path. A webhook or queue consumer without a guard emails the user once per retry, and sending cannot be undone.
  • Every template needs a plain-text alternative.

Deliverability

  • Send from a dedicated transactional subdomain, never the primary domain.
  • Handle email.bounced and email.complained, and suppress those addresses. Continuing to send to bounces destroys sender reputation.
  • Verify webhook signatures — the endpoint is public.

Templates

  • Mail clients support a fraction of modern CSS; Outlook renders with Word. Tables and inline styles.
  • Never put a token, password or session id in an email body. Send a short-lived, single-use link instead.

Never

  • Never log full recipient lists or message bodies.
  • Never send bulk or marketing mail through a transactional flow without unsubscribe handling.

As each tool receives it

The same guidance, in the shape each editor reads. Cursor and Claude Code are written separately by hand; the rest are derived from the Cursor rule.

.cursor/rules/resend.mdchand-written for this tool
.cursor/rules/resend.mdc
---
description: Resend transactional email conventions
globs: ["server/**", "api/**", "emails/**", "src/services/email/**"]
alwaysApply: false
---

# Resend

## Where it runs

- **Server-side only.** The API key sends mail as your domain to any recipient.
  Never in the app, never in an `EXPO_PUBLIC_*` variable.

## Sending

- Check the returned `error` — the SDK returns `{ data, error }` and does not
  throw. An unchecked error is indistinguishable from success.
- **Idempotency on any retryable path.** A webhook or queue consumer without a
  guard emails the user once per retry, and sending cannot be undone.
- Every template needs a plain-text alternative.

## Deliverability

- Send from a dedicated transactional subdomain, never the primary domain.
- Handle `email.bounced` and `email.complained`, and suppress those addresses.
  Continuing to send to bounces destroys sender reputation.
- Verify webhook signatures — the endpoint is public.

## Templates

- Mail clients support a fraction of modern CSS; Outlook renders with Word.
  Tables and inline styles.
- Never put a token, password or session id in an email body. Send a
  short-lived, single-use link instead.

## Never

- Never log full recipient lists or message bodies.
- Never send bulk or marketing mail through a transactional flow without
  unsubscribe handling.

What else this module writes

Selecting Resend contributes more than a rule file — all of it merged with every other module you pick, with conflicts resolved rather than duplicated.

Environment
RESEND_API_KEYrequiredSends email. Never ship in the app.
RESEND_FROM_EMAILrequiredVerified sender. Use a dedicated transactional subdomain.
RESEND_WEBHOOK_SECREToptionalVerifies bounce and complaint webhooks. The endpoint is public.
Dependencies
resend^6.18.0@react-email/components^1.0.0dev
Folders
emails/server/email/

Related

Put this in your repo

Adds Resend to a project this tool generated, without starting over. Files you have hand-edited are left alone.