Send transactional email through the Resend API (send, batch, scheduled, attachments, React Email), verify delivery webhooks with Svix signatures, and set up SPF/DKIM/DMARC for real deliverability. Triggers on "send email via Resend", "set up transactional email", "Resend webhook bounces", "email deliverability setup", Resend API integration.
./install.sh resend-email-integrationname: resend_email_integration description: Send transactional email through the Resend API (send, batch, scheduled, attachments, React Email), verify delivery webhooks with Svix signatures, and set up SPF/DKIM/DMARC for real deliverability. Triggers on "send email via Resend", "set up transactional email", "Resend webhook bounces", "email deliverability setup", Resend API integration.
Wire up transactional email in an app using Resend's API: single sends, batches, scheduled sends, attachments, React Email templates, bounce/complaint webhooks, and domain authentication. Covers the full loop from API key to delivered inbox, including the failure paths that matter in production.
npm install resend or pip install resend), set RESEND_API_KEY (starts with re_). For anything beyond testing, verify a sending domain first (see references/deliverability.md). The shared onboarding@resend.dev sandbox only sends to the email the account registered with, so a verified domain is a hard requirement for real recipients.Single (Node, the { data, error } pattern is mandatory):
ts
import { Resend } from 'resend';
const resend = new Resend(process.env.RESEND_API_KEY);
const { data, error } = await resend.emails.send({
from: 'Acme <hello@yourdomain.com>',
to: ['user@example.com'],
subject: 'Welcome',
html: '<p>Thanks for signing up.</p>',
text: 'Thanks for signing up.', // always include a text part
});
if (error) { console.error('Send failed:', error.message); return; }
console.log('Sent:', data.id);
Python with idempotency (prevents duplicate sends on retry):
python
import os, resend
resend.api_key = os.environ["RESEND_API_KEY"]
resend.Emails.send(
{"from": "Acme <hello@yourdomain.com>",
"to": ["user@example.com"],
"subject": "Welcome",
"html": "<p>Thanks for signing up.</p>"},
idempotency_key=f"welcome-email/{user_id}",
)
Batch (2-100 distinct emails, one call):
ts
await resend.batch.send([
{ from: 'Acme <hello@yourdomain.com>', to: 'a@x.com', subject: 'Digest', html: '<p>A</p>' },
{ from: 'Acme <hello@yourdomain.com>', to: 'b@x.com', subject: 'Digest', html: '<p>B</p>' },
]);
Scheduled (single sends only, not batch):
ts
await resend.emails.send({
from: 'Acme <hello@yourdomain.com>',
to: ['user@example.com'],
subject: 'Reminder',
html: '<p>Tomorrow at 9am.</p>',
scheduledAt: 'tomorrow at 9am', // natural language or ISO date like 2026-11-01T09:00:00Z
});
Attachment (base64 content):
ts
await resend.emails.send({
from: 'Acme <hello@yourdomain.com>',
to: ['user@example.com'],
subject: 'Your invoice',
html: '<p>Attached.</p>',
attachments: [{ filename: 'invoice.pdf', content: pdfBuffer.toString('base64') }],
});
React Email template (rendered component):
ts
import { WelcomeEmail } from '@/emails/welcome';
await resend.emails.send({
from: 'Acme <hello@yourdomain.com>',
to: ['user@example.com'],
subject: 'Welcome',
react: WelcomeEmail({ name: 'Alice' }),
});
POST /emails): one email, attachments, scheduling. Batch (POST /emails/batch): 2-100 emails, atomic (one invalid email fails the whole batch), no attachments, no scheduling.whsec_) as RESEND_WEBHOOK_SECRET, and verify every inbound event before trusting it. Respond 200 on success so Resend stops retrying. Full pattern in references/webhooks.md.onboarding@resend.dev. Verify a domain first; the sandbox errors on any other recipient.error on every send. The Node SDK does not throw on API errors.<event-type>/<entity-id>) on every retried or queue-driven send. Same key plus different payload returns 409.email.received webhooks carry metadata only. Fetch the body with resend.emails.receiving.get(email_id) when needed.publisher key 2e43c913833850e6d80f939677e3de76e806d47785c0f1caaca90f9d18c98e1e
No ratings yet — be the first to rate it.