@latimer-woods-tech/email
Typed transactional email using Resend. Depends on@latimer-woods-tech/errors and @latimer-woods-tech/logger.
Documentation Index
Fetch the complete documentation index at: /llms.txt
Use this file to discover all available pages before exploring further.
Transactional email via Resend with typed templates.
@latimer-woods-tech/errors and @latimer-woods-tech/logger.
npm install @latimer-woods-tech/email
wrangler secret put RESEND_API_KEY
sendEmail(opts)function sendEmail(opts: {
apiKey: string;
from: string;
to: string | string[];
subject: string;
html: string;
text?: string;
replyTo?: string;
tags?: Record<string, string>;
}): Promise<{ id: string }>;
renderTemplate(template, data)function renderTemplate(
template: EmailTemplate,
data: Record<string, unknown>,
): { subject: string; html: string; text: string };
| Template | Use case |
|---|---|
welcome | New user sign-up confirmation |
subscription-created | Payment successful, plan started |
subscription-canceled | Subscription ended |
trial-ending | Trial expires in N days |
password-reset | Password reset link |
import { sendEmail, renderTemplate } from '@latimer-woods-tech/email';
const { subject, html, text } = renderTemplate('welcome', {
firstName: 'Jane',
appName: 'FocusBro',
loginUrl: 'https://focusbro.app/login',
});
await sendEmail({
apiKey: env.RESEND_API_KEY,
from: 'hello@focusbro.app',
to: user.email,
subject,
html,
text,
});