← Re: [CSplus/RelationshipCRM] feat: EmailCampaign メール配信機能 (PR #14)
メール履歴を編集
送受信区分
*
送信
受信
日時
*
件名
*
本文
@chatgpt-codex-connector[bot] commented on this pull request. ### 💡 Codex Review Here are some automated review suggestions for this pull request. **Reviewed commit:** `70e53d29eb` <details> <summary>ℹ️ About Codex in GitHub</summary> <br/> [Your team has set up Codex to review pull requests in this repo](https://chatgpt.com/codex/cloud/settings/general). Reviews are triggered when you - Open a pull request for review - Mark a draft as ready - Comment "@codex review". If Codex has suggestions, it will comment; otherwise it will react with 👍. Codex can also answer questions or update the PR. Try commenting "@codex address that feedback". </details> > + const raw = buildRawMessage({ from: fromAddress, to, subject, body }); + const result = await api.sendRaw(raw); **<sub><sub></sub></sub> Claim recipients before calling Gmail** When two batch executions for the same campaign run outside the same Node process (for example multiple server replicas or a retry that does not share the in-memory `processingCampaigns` set), both can read the same `PENDING` recipient and both call `api.sendRaw` here before the later `updateMany(... status: "PENDING")` detects that one lost the race. The loser rolls back its DB changes, but the email has already been delivered, so customers can receive duplicate campaign mail; claim/transition the row atomically before sending, or use a DB-level lock/status. Useful? React with 👍 / 👎. > + const recipients = await prisma.emailCampaignRecipient.findMany({ + where: { campaignId, status: "PENDING" }, + include: { contact: { include: { company: true } } }, **<sub><sub></sub></sub> Recheck opt-outs at send time** For draft or scheduled campaigns, a contact can be marked `emailOptOut` after the campaign is created but before it is sent; this query still loads every `PENDING` recipient and the loop sends to the stored address without checking `recipient.contact.emailOptOut`. That bypasses the opt-out flag for delayed sends, so recipients who unsubscribed after preview/creation can still be emailed; filter or mark them `SKIPPED` immediately before `sendRaw`. Useful? React with 👍 / 👎. -- Reply to this email directly or view it on GitHub: https://github.com/CSplus/RelationshipCRM/pull/14#pullrequestreview-4678329854 You are receiving this because you authored the thread. Message ID: <CSplus/RelationshipCRM/pull/14/review/4678329854@github.com>
会社または連絡先のどちらか一方は必ず指定してください(両方も可)
連絡先(相手)
指定なし
会社
指定なし
連絡先を選ぶと所属会社が自動でセットされます(変更可)
更新する