React Email rendering, email design constraints, adding templates, configuration, and production verification.
Named templates make security-sensitive transactional mail an owned code path
instead of accepting markup from the browser. The current
PortalSignInOtpEmail is a React Email component rendered to both HTML and
plain text by @react-email/render.
The component includes:
email-theme.ts owns the small email-specific palette. The component uses
React Email's pixel-based Tailwind preset because email clients need compiled,
portable styles; it does not depend on the web applications' runtime CSS or
theme state. PreviewProps supplies safe sample data for template previewing.
resolveMailMessage renders the same component twice: normal rendering creates
the HTML document and { plainText: true } creates the text alternative. A new
named template must preserve both forms. Do not make essential content depend
on remote images, custom fonts, client-side JavaScript, hover, or dark-mode
support.
@scs/schemas, including bounded recipients and props.src/emails with safe preview data.resolveMailMessage with an exhaustive template-name branch and an
owned subject.Do not accept a user-supplied template name, subject, or markup when the use case can be represented by a bounded named template. Do not interpolate unvalidated URLs or HTML into a component.
T3 Env validates configuration at startup. MAILER_API_KEY and SMTP_HOST are
required non-empty values; SMTP_SECURE accepts only true or false; PORT
is an integer from 1 through 65535. SMTP user and password have empty local
defaults and SMTP_FROM falls back to the user. The canonical inventory and
deployment ownership are in
Environment variables.
The Mailer is independently deployed. vercel.json selects Bun 1.x, while the
deployment adapter owns VERCEL_EXPERIMENTAL_BACKENDS; application code does
not read that value.
Use a non-production recipient and verify:
{ "ok": true };Source tests must not use real SMTP credentials. Record provider-side delivery as a credential-dependent check, not as part of the unit-suite result.