resend api 要求发件人地址(from)必须使用已验证的自定义域名,否则 cc 和 bcc 字段将被静默忽略——这是服务端安全策略,而非代码或参数错误。
resend api 要求发件人地址(from)必须使用已验证的自定义域名,否则 cc 和 bcc 字段将被静默忽略——这是服务端安全策略,而非代码或参数错误。
在使用 Resend 发送带抄送(CC)和密送(BCC)的邮件时,关键限制并非来自免费版配额,而是身份验证机制:Resend 严格要求 from 地址必须属于你已在控制台完成 DNS 验证的自定义域名(如 noreply@yourdomain.com),而不能使用 @resend.dev 或其他未验证的邮箱(包括带 Cloudflare 邮箱保护的 标签格式地址)。你当前代码中使用的 是 Cloudflare 的邮箱混淆 HTML 片段,并非真实可解析的邮箱地址,这直接导致请求被降级处理——API 接收参数但忽略 cc/bcc 字段,仅向 to 发送。
✅ 正确配置步骤
-
注册并验证自定义域名
登录 Resend Dashboard → Domains → 点击 Add Domain → 输入你的域名(如 yourdomain.com)→ 按提示添加以下 DNS 记录:TXT resend._domainkey.yourdomain.com k=rsa; p=MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQC... TXT yourdomain.com v=spf1 include:resend.com ~all CNAME email.yourdomain.com u123456789.resend-emails.com
(记录值需从 Resend 控制台获取,验证通常需 1–24 小时)
-
更新 from 地址为已验证域名邮箱
修改代码中的 from 字段,使用你域名下的真实邮箱(如 noreply@yourdomain.com),移除所有 HTML 标签和 Cloudflare 混淆:const emailData = { from: 'noreply@yourdomain.com', // ✅ 必须是已验证域名的邮箱 to: TO, subject: subject, html: body, cc: CC, // ✅ 现在会生效 bcc: CCO // ✅ 现在会生效 }; -
确保传入的 CC/BCC 是字符串数组(推荐)
Resend 官方文档明确要求 cc 和 bcc 接收 字符串数组,而非单个字符串。你的 Postman 示例中 "CC": "xxx@yyy.com" 应改为:{ "TO": ["user@example.com"], "subject": "xd", "body": "<p>hola</p><div class="aritcle_card flexRow artxards"> <div class="artcardd flexRow"> <a class="aritcle_card_img" rel="nofollow" href="/ai/2572" title="There’s An AI For That"><img src="https://img.php.cn/upload/ai_manual/001/246/273/176907461470611.png" alt="There’s An AI For That" onerror="this.onerror='';this.src='/static/lhimages/moren/morentu.png'" ></a> <div class="aritcle_card_info flexColumn"> <a rel="nofollow" href="/ai/2572" title="There’s An AI For That" class="overflowclass">There’s An AI For That</a> <p class="overflowclass">一款AI工具,主要用于全球领先的 AI 聚合器,收集10,225个AI工具,可用于超过2,548个任务,适合需要提升相关任务效率的用户。</p> </div> <a rel="nofollow" href="/ai/2572" title="There’s An AI For That" class="aritcle_card_btn flexRow flexcenter"><b></b><span>下载</span> </a> </div> </div>", "CC": ["cc@example.com"], "CCO": ["bcc@example.com"] }对应后端解构也需适配:
const { TO, subject, body, CC, CCO } = req.body; // 确保 TO/CC/CCO 均为数组(即使单个收件人) const emailData = { from: 'noreply@yourdomain.com', to: Array.isArray(TO) ? TO : [TO], cc: Array.isArray(CC) ? CC : CC ? [CC] : [], bcc: Array.isArray(CCO) ? CCO : CCO ? [CCO] : [], subject, html: body };
⚠️ 注意事项
- 免费版完全支持 CC/BCC:Resend 免费计划(1000 邮件/月)不限制抄送功能,限制仅在于发件人身份验证。
- from 地址不可伪造:即使你拥有 @gmail.com 邮箱,也不能设为 from;必须是 Resend 已验证的域名邮箱。
- 日志验证方式:成功发送后,在 Resend Dashboard 的 Emails 页面查看具体邮件详情,点击展开 “Recipients” 可确认 cc/bcc 是否被正确接收并投递。
- 调试建议:启用 console.log(emailData) 输出实际构造的请求体,确保 cc/bcc 字段为非空数组且格式合规。
完成域名验证后,你的 CC/BCC 将立即生效——无需升级套餐、无需额外配置。这是 Resend 为防止邮件滥用而实施的强制性安全设计,也是其与 SendGrid、Mailgun 等服务一致的最佳实践。
大量免费API接口:立即使用
涵盖生活服务API、金融科技API、企业工商API、等相关的API接口服务。免费API接口可安全、合规地连接上下游,为数据API应用能力赋能!









