Email Overview

Transactional email for Nebutra — cataloged sender helpers, local previews, and Resend delivery via @nebutra/email.

Nebutra sends transactional emails through the @nebutra/email package. The current implementation is catalog-first: EMAIL_TEMPLATE_CATALOG in packages/integrations/email/src/index.ts maps every public sender helper to its preview artifact, while Resend is loaded lazily only when an email is actually sent.

Architecture

Server action / route / job / webhook
  -> named sender helper from @nebutra/email
  -> branded HTML envelope
  -> lazy Resend client
  -> recipient inbox

No-key workflows can import the package, run contract tests, and validate local preview output without RESEND_API_KEY. Real delivery still requires Resend credentials.

Built-in catalog

The package currently tracks 15 templates:

Catalog IDPublic helperPreview artifact
welcomesendWelcomeEmailwelcome-email.html
order-confirmationsendOrderConfirmationEmailorder-confirmation-email.html
api-key-createdsendApiKeyCreatedEmailapi-key-created-email.html
quota-warningsendQuotaWarningEmailquota-warning-email.html
team-invitationsendInviteEmailteam-invitation-email.html
magic-linksendMagicLinkEmailmagic-link-email.html
contact-form-receivedsendContactFormReceivedEmailcontact-form-received-email.html
checkout-completedsendCheckoutCompletedEmailcheckout-completed-email.html
trial-endingsendTrialEndingEmailtrial-ending-email.html
invoice-paidsendInvoicePaidEmailinvoice-paid-email.html
payment-failedsendPaymentFailedEmailpayment-failed-email.html
subscription-canceledsendSubscriptionCanceledEmailsubscription-canceled-email.html
upcoming-invoicesendUpcomingInvoiceEmailupcoming-invoice-email.html
plan-changedsendPlanChangedEmailplan-changed-email.html
license-createdsendLicenseCreatedEmaillicense-created-email.html

Quick start

import { sendQuotaWarningEmail, sendWelcomeEmail } from "@nebutra/email";

await sendWelcomeEmail({
  to: user.email,
  firstName: user.firstName,
  orgName: org.name,
  dashboardUrl: "https://app.nebutra.com",
});

await sendQuotaWarningEmail({
  to: admin.email,
  orgName: org.name,
  metric: "api calls",
  used: 8100,
  limit: 10000,
  percentUsed: 81,
});

Environment variables

VariableRequired for sendDescription
RESEND_API_KEYYesResend API key, loaded only when sending
EMAIL_FROMNoSender address, defaults to Nebutra <[email protected]>

RESEND_API_KEY is a secret. Never commit it. Store it in Vercel environment variables, CI secrets, or your secrets manager.

Local preview

Use the mail preview workspace rather than editing generated HTML:

pnpm mail:check
pnpm mail:export

mail:check verifies that every catalog entry has a generated preview artifact. mail:export regenerates the preview index and manifest from the catalog.

How is this guide?

Edit on GitHub

Last updated on

On this page