resend

Compare original and translation side by side

🇺🇸

Original

English
🇨🇳

Translation

Chinese

Resend

Resend

Overview

概述

Resend is a modern email API built for developers, providing programmatic email sending with support for React Email components, domain management, and webhook-driven event tracking.
When to use: Transactional emails (welcome, password reset, receipts), batch email delivery, scheduled sending, webhook-based delivery tracking, domain verification, React Email integration.
When NOT to use: High-volume marketing automation (use dedicated ESP), SMS/push notifications, email hosting/inbox management.
Resend 是一款为开发者打造的现代化邮件API,支持通过编程方式发送邮件,同时兼容React Email组件、域名管理以及基于Webhook的事件追踪功能。
适用场景: 事务性邮件(欢迎邮件、密码重置、收据)、批量邮件投递、定时发送、基于Webhook的投递追踪、域名验证、React Email集成。
不适用场景: 高容量营销自动化(请使用专用ESP)、短信/推送通知、邮件托管/收件箱管理。

Quick Reference

快速参考

PatternAPIKey Points
Send email
resend.emails.send({ from, to, subject })
Returns
{ data, error }
, supports html/text/react content
Send with React
resend.emails.send({ react: <Email /> })
Node.js SDK only, renders React Email components server-side
Batch send
resend.batch.send([...emails])
Multiple emails in one request, no attachments/scheduling
Schedule email
emails.send({ scheduled_at })
ISO 8601 or natural language, cancel before send window
Attachments
emails.send({ attachments: [...] })
Max 40MB total after encoding, supports content or path
Idempotent send
emails.send(params, { idempotencyKey })
Prevents duplicate sends on retry
Retrieve email
resend.emails.get(emailId)
Check delivery status and metadata
Add domain
resend.domains.create({ name })
Returns DNS records for SPF, DKIM, MX
Verify domain
resend.domains.verify(domainId)
Triggers DNS record check
List domains
resend.domains.list()
Returns all domains with status
Create webhookDashboard or APISubscribe to email lifecycle events
Verify webhook
resend.webhooks.verify({ payload, ... })
Validates Svix signature headers
Tags
emails.send({ tags: [...] })
Key-value pairs for categorization, ASCII only, max 256 chars
Custom headers
emails.send({ headers: {...} })
Add custom email headers
Create contact
resend.contacts.create({ email, ... })
Global contacts with custom properties
List contacts
resend.contacts.list()
Returns all contacts
Create broadcast
resend.broadcasts.create({ from, ... })
Bulk email to a segment, supports template variables
Send broadcast
resend.broadcasts.send(id, { segmentId })
Delivers broadcast to a segment of contacts
模式API核心要点
发送邮件
resend.emails.send({ from, to, subject })
返回
{ data, error }
,支持html/text/react格式内容
使用React发送邮件
resend.emails.send({ react: <Email /> })
仅支持Node.js SDK,在服务端渲染React Email组件
批量发送邮件
resend.batch.send([...emails])
单次请求发送多封邮件,不支持附件和定时功能
定时发送邮件
emails.send({ scheduled_at })
支持ISO 8601格式或自然语言,可在发送窗口前取消
附件处理
emails.send({ attachments: [...] })
编码后总大小最大40MB,支持内容或文件路径两种方式
幂等发送
emails.send(params, { idempotencyKey })
避免重试时重复发送邮件
检索邮件信息
resend.emails.get(emailId)
查看邮件投递状态及元数据
添加域名
resend.domains.create({ name })
返回用于SPF、DKIM、MX验证的DNS记录
验证域名
resend.domains.verify(domainId)
触发DNS记录检查
列出所有域名
resend.domains.list()
返回所有域名及其状态
创建Webhook控制台或API方式订阅邮件生命周期事件
验证Webhook
resend.webhooks.verify({ payload, ... })
验证Svix签名头
标签功能
emails.send({ tags: [...] })
用于分类的键值对,仅支持ASCII字符,最大256个字符
自定义头信息
emails.send({ headers: {...} })
添加自定义邮件头信息
创建联系人
resend.contacts.create({ email, ... })
全局联系人,支持自定义属性
列出所有联系人
resend.contacts.list()
返回所有联系人信息
创建批量邮件任务
resend.broadcasts.create({ from, ... })
向用户分组发送批量邮件,支持模板变量
发送批量邮件
resend.broadcasts.send(id, { segmentId })
向指定用户分组投递批量邮件

Common Mistakes

常见错误

MistakeCorrect Pattern
Using root domain for sendingUse a subdomain like
send.yourdomain.com
to isolate reputation
Not checking
error
in response
Always destructure
{ data, error }
and handle errors
Sending attachments in batch requestsAttachments and scheduling are not supported in batch sends
Hardcoding API key in source codeUse environment variable
RESEND_API_KEY
Skipping webhook signature verificationAlways verify using Svix headers before processing events
Using
react
prop outside Node.js SDK
The
react
prop only works with the Node.js SDK
Not setting up DMARC after SPF/DKIM verifyAdd DMARC record after SPF and DKIM pass to improve deliverability
Exceeding 50 recipients in a single sendUse batch send or loop for more than 50 recipients per request
Using
&&
for tag name/value characters
Tag names and values must be ASCII letters, numbers,
_
, or
-
Ignoring bounce/complaint webhooksMonitor
email.bounced
and
email.complained
to protect reputation
错误操作正确做法
使用根域名发送邮件使用子域名(如
send.yourdomain.com
)隔离信誉
未检查响应中的
error
字段
始终解构
{ data, error }
并处理错误
在批量请求中发送附件批量发送不支持附件和定时功能
在源代码中硬编码API密钥使用环境变量
RESEND_API_KEY
跳过Webhook签名验证处理事件前务必使用Svix头信息进行验证
在Node.js SDK外使用
react
属性
react
属性仅适用于Node.js SDK
SPF/DKIM验证通过后未设置DMARCSPF和DKIM验证通过后添加DMARC记录以提升投递率
单次发送收件人超过50个超过50个收件人时使用批量发送或循环请求
标签名称/值中使用
&&
字符
标签名称和值仅支持ASCII字母、数字、
_
-
忽略退信/投诉Webhook事件监控
email.bounced
email.complained
事件以保护发件人信誉

Delegation

任务委托

  • Email template design: Use
    Explore
    agent to discover React Email component patterns
  • Domain DNS configuration: Use
    Task
    agent for step-by-step DNS setup verification
  • Webhook endpoint setup: Use
    Task
    agent for route handler implementation
  • 邮件模板设计:使用
    Explore
    工具探索React Email组件模式
  • 域名DNS配置:使用
    Task
    工具进行分步DNS设置验证
  • Webhook端点设置:使用
    Task
    工具实现路由处理器

References

参考资料

  • Sending emails, batch sending, attachments, scheduling, and idempotency
  • Contacts, Segments, Broadcasts, template variables, and bulk sending
  • Domain verification, DNS records, and sender identity management
  • Webhook events, signature verification, and event handling
  • 邮件发送、批量发送、附件、定时发送与幂等性
  • 联系人、用户分组、批量邮件、模板变量与批量发送
  • 域名验证、DNS记录与发件人身份管理
  • Webhook事件、签名验证与事件处理