E-mail channels send each matching event to their recipients, with one retry and the last error recorded #155

Open
opened 2026-10-31 12:42:16 -04:00 by claude · 0 comments
Owner
  • Draft: PN-17
  • Priority: high
  • Agent: coder
  • Depends on: #154
  • Decisions: Q-PN-8

Why

E-mail is the second channel kind the owner's unified model needs; SMTP exists only for identity mail today.

What changes

  • New EmailChannelSender in src/dotnet/src/Ninlil.Dns.Server.Notifications/, sending through IEmailSender (src/dotnet/src/Ninlil.Dns.Identity/Email/IEmailSender.cs:18-23). Add a ProjectReference to Ninlil.Dns.Identity. Technical call: Ninlil.Dns.Identity references only Ninlil.Dns.Data.Abstractions (Ninlil.Dns.Identity.csproj:45), so no cycle forms.
  • The stored Payload is {"subject":"...","body":"..."}, rendered once with #154's renderer: the body HTML-escaped, the subject unescaped with CR and LF removed so a value cannot add a header line. One SendAsync per recipient; the attempt succeeds only when every recipient succeeds, and a retry sends to every recipient again (at least once, as webhooks are).
  • Best effort (Q-PN-8): an e-mail channel's attempts are capped at two, whatever MaxDeliveryAttempts says. The retry goes through the existing sweep.
  • No SMTP host in EmailSenderOptions (the check SmtpEmailSender.cs:22-25 describes) is a permanent failure with the message "SMTP is not configured", so the delivery is dead-lettered at once and the reason shows in the history.

Acceptance

  • This test fails first: Deliver_ForAnEmailChannel_SendsOneMailPerRecipient with a fake IEmailSender, in src/dotnet/tests/Ninlil.Dns.Server.Notifications.Tests.
  • Tests: HTML escaping in the body; CR/LF removed from the subject; a failed send leaves a pending row with one retry and dead-letters after the second; no SMTP host dead-letters at once.
  • Gate: dotnet test src/dotnet/tests/Ninlil.Dns.Server.Notifications.Tests, dotnet test src/dotnet/tests/Ninlil.Web.Tests.

Source

audit-feature-parity.md §2A #12.
Owner decision 2026-10-31: "mail retry: best effort" (Q-PN-8).

- **Draft:** PN-17 - **Priority:** high - **Agent:** coder - **Depends on:** #154 - **Decisions:** Q-PN-8 ### Why E-mail is the second channel kind the owner's unified model needs; SMTP exists only for identity mail today. ### What changes - New `EmailChannelSender` in `src/dotnet/src/Ninlil.Dns.Server.Notifications/`, sending through `IEmailSender` (`src/dotnet/src/Ninlil.Dns.Identity/Email/IEmailSender.cs:18-23`). Add a `ProjectReference` to `Ninlil.Dns.Identity`. Technical call: `Ninlil.Dns.Identity` references only `Ninlil.Dns.Data.Abstractions` (`Ninlil.Dns.Identity.csproj:45`), so no cycle forms. - The stored `Payload` is `{"subject":"...","body":"..."}`, rendered once with #154's renderer: the body HTML-escaped, the subject unescaped with CR and LF removed so a value cannot add a header line. One `SendAsync` per recipient; the attempt succeeds only when every recipient succeeds, and a retry sends to every recipient again (at least once, as webhooks are). - Best effort (Q-PN-8): an e-mail channel's attempts are capped at two, whatever `MaxDeliveryAttempts` says. The retry goes through the existing sweep. - No SMTP host in `EmailSenderOptions` (the check `SmtpEmailSender.cs:22-25` describes) is a permanent failure with the message "SMTP is not configured", so the delivery is dead-lettered at once and the reason shows in the history. ### Acceptance - [ ] This test fails first: `Deliver_ForAnEmailChannel_SendsOneMailPerRecipient` with a fake `IEmailSender`, in `src/dotnet/tests/Ninlil.Dns.Server.Notifications.Tests`. - [ ] Tests: HTML escaping in the body; CR/LF removed from the subject; a failed send leaves a pending row with one retry and dead-letters after the second; no SMTP host dead-letters at once. - [ ] Gate: `dotnet test src/dotnet/tests/Ninlil.Dns.Server.Notifications.Tests`, `dotnet test src/dotnet/tests/Ninlil.Web.Tests`. ### Source `audit-feature-parity.md` §2A #12. Owner decision 2026-10-31: "mail retry: best effort" (Q-PN-8).
Sign in to join this conversation.
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Reference
lantea-one/ninlil#155
No description provided.