Repository navigation
【功能】someday 开启 Resend 发信支持(对齐 cloud-mail 通道模式) - #38
Merged
todosdev[bot] merged 2 commits intoOct 29, 2026
Merged
Conversation
added 2 commits
October 29, 2026 21:19
- admin-resend PUT 按提交键整体重建 resend_tokens(缺失键=删除、留空=保留) - 新增独立 resend_sender 键与 readResendSender,发件身份不再读 smtp_config - EmailOptions 增加 channel 覆盖,SMTP 测试邮件显式走 smtp - verifyResendSignature 的 importKey/sign 包 try/catch,严格 v1, 前缀校验 Checkpoint: U-lKHk2lM8legl1jHdlKu
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
resendTokens通道模式),解决 ONE-173: web 基座与公开信墙首页 #5 定案根因——Lark 出口 IP 被 RBL 收录导致投递段 554 拒收、sent却不可见的问题。smtp时与现状逐字节一致;切到resend走 Resend API 直连。delivered / bounced / failed / complained回写到letter_recipients,并透出收件人级投递状态到 API 与详情页,让「已寄出但实际丢信」可见。Changes
worker(后端)
services/resend.ts(新增):sendResendEmail(Resend API 直连、单收件人单发)、verifyResendSignature(Svix HMAC-SHA256,fail-closed)、applyResendEvent(按email_id反查message_id回写)、readResendTokens/readResendSender(配置读取)。services/email.ts:sendEmail()加渠道分支;EmailOptions增channel覆盖(供 SMTP 测试邮件强制走 smtp);Resend 分支发件身份读独立resend_sender,与smtp_config解耦。routes/admin-resend.ts(新增):GET/PUT /api/admin/settings/resend(渠道二选一 +{域名: token}脱敏读写,删除域名按提交键整体重建)、POST /resend/test。routes/resend-webhook.ts(新增):POST /api/resend/webhook公开入口,验签失败/密钥缺失 fail-closed 401。routes/admin-smtp.ts:SMTP 测试邮件显式channel: "smtp"。services/send-throttle.ts:classifySendFailure扩展 HTTP 码语义(429 → throttle、4xx → permanent、5xx → other),services/scheduler.ts透传http标记。routes/letters.ts:serializeLetter收件人补status/error/sent_at。types.ts:Env增RESEND_WEBHOOK_SECRET?: string;index.ts挂载新路由。web(前端)
api/admin.ts:Resend 配置类型与getResend/updateResend/testResend。components/settings/resend-section.tsx(新增):渠道二选一、按域名填 token(脱敏回显、可删除)、发件身份、测试邮件。api/letters.ts+pages/letter-detail.tsx:收件人级投递状态徽标与失败原因。pages/admin.tsx挂载ResendSection;api/mock/*全链路打通。Testing
pnpm typecheck、pnpm build、pnpm test全绿(web 160 + worker 245)。v1,前缀、webhook 事件映射(delivered 幂等 / bounced 翻 failed / 未知 id 返 200)、admin 配置脱敏与渠道校验、域名删除、发件身份解耦、classifySendFailureHTTP 分类、收件人状态透出。