Telaio
API Reference

Email API Reference

Complete reference for sendReactEmail, EmailSendOptions, and EmailConfig.

Email API Reference

Import path: telaio/email

Telaio's email module sends transactional email via AWS SES using React Email components for template rendering. Both the HTML and plain-text versions of the email are rendered automatically from the React component.


Peer dependencies

pnpm add @aws-sdk/client-ses @react-email/components

Both are optional peer dependencies. They are not installed by default. Add them only when your application sends email.


sendReactEmail(options, config)

Renders a React Email component to HTML and plain text, then sends the message via AWS SES.

Signature

async function sendReactEmail(
  options: EmailSendOptions,
  config: EmailConfig
): Promise<void>
import { sendReactEmail } from 'telaio/email';
import { WelcomeEmail } from './emails/WelcomeEmail.js';

await sendReactEmail(
  {
    from: 'noreply@myapp.com',
    to: user.email,
    subject: 'Welcome to MyApp!',
    react: <WelcomeEmail name={user.name} />,
  },
  { region: 'us-east-1' },
);

EmailSendOptions

FieldTypeDescription
fromstringSender address; must be verified in AWS SES
tostringRecipient email address
subjectstringEmail subject line
reactanyReact element (ReactNode) to render as both HTML and plain text

EmailConfig

Note: this is the config object passed directly to sendReactEmail. It is distinct from the email key in Telaio's application config module.

FieldTypeDescription
regionstringAWS SES region (e.g. us-east-1, eu-west-1)

AWS credentials

sendReactEmail does not accept explicit credentials. The AWS SDK resolves credentials through the default provider chain in order:

  1. AWS_ACCESS_KEY_ID / AWS_SECRET_ACCESS_KEY environment variables
  2. Shared credentials file (~/.aws/credentials)
  3. ECS task role, EC2 instance profile, or EKS service account (IAM role)

For local development, set the environment variables. In production, attach an IAM role to your compute resource and omit explicit credentials entirely.

# Local development
AWS_ACCESS_KEY_ID=AKIA...
AWS_SECRET_ACCESS_KEY=...
AWS_SES_REGION=us-east-1
EMAIL_FROM=noreply@myapp.com

On this page