server: Mailer — page-ready email over SMTP, outbox for dev/e2e (phase-2 plan Task 5) #32

Closed
opened 2026-08-28 21:00:25 +00:00 by ben · 1 comment
Owner

Plan

docs/superpowers/plans/2026-08-28-coa-phase-2.md Task 5.

Deliverable

server/src/mailer.ts: Mailer { sendPageReady(PageReadyMail) }, pure renderPageReadyEmail(m, from) → Mail (text + html), smtpMailer(env) (nodemailer, secure only on 465, optional tls.servername), outboxMailer(dir, from) (one JSON file per mail), mailerFromEnv(process.env) (SMTP when SMTP_HOST set, else outbox at COA_MAIL_OUTBOX ?? '.outbox'). Deps: nodemailer@^6.10, @types/nodemailer, @coa/templates (for escapeHtml). AppDeps.mailer + AppDeps.publicUrl (COA_PUBLIC_URL, trailing slash stripped). .env.example: SMTP_FROM, SMTP_TLS_SERVERNAME, COA_MAIL_OUTBOX; .gitignore .outbox/. Tests server/test/mailer.test.ts.

Copy (draft — product-decision, veto on this ticket)

Subject Your <name> app page is ready. Body: "Kia ora, / Your community page for is live: / It shows "build pending" for now — we'll email you again when the installers are built. / Ngā mihi, Matou".

Acceptance

  • Subject, URL in both bodies, from/to set; community name escaped in HTML.
  • Outbox writes exactly one file whose to matches.
  • No test sends real mail; smtpMailer is only constructed, never exercised, in tests.

depends_on

  • templates: community page renderer (Task 4)

out_of_scope

Sending from /api/submit (Task 6); the real SMTP password (human ticket).

Phase gate

No build dispatch, no coa-shared provisioning, no status transitions beyond page-ready (phase 3). Never delete or rewrite anything under communities/ (ADR 0002/0003).

## Plan `docs/superpowers/plans/2026-08-28-coa-phase-2.md` **Task 5**. ## Deliverable `server/src/mailer.ts`: `Mailer { sendPageReady(PageReadyMail) }`, pure `renderPageReadyEmail(m, from) → Mail` (text + html), `smtpMailer(env)` (nodemailer, `secure` only on 465, optional `tls.servername`), `outboxMailer(dir, from)` (one JSON file per mail), `mailerFromEnv(process.env)` (SMTP when `SMTP_HOST` set, else outbox at `COA_MAIL_OUTBOX ?? '.outbox'`). Deps: `nodemailer@^6.10`, `@types/nodemailer`, `@coa/templates` (for `escapeHtml`). `AppDeps.mailer` + `AppDeps.publicUrl` (`COA_PUBLIC_URL`, trailing slash stripped). `.env.example`: `SMTP_FROM`, `SMTP_TLS_SERVERNAME`, `COA_MAIL_OUTBOX`; `.gitignore` `.outbox/`. Tests `server/test/mailer.test.ts`. ## Copy (draft — product-decision, veto on this ticket) Subject `Your <name> app page is ready`. Body: "Kia ora, / Your community page for <name> is live: <url> / It shows "build pending" for now — we'll email you again when the installers are built. / Ngā mihi, Matou". ## Acceptance - Subject, URL in both bodies, `from`/`to` set; community name escaped in HTML. - Outbox writes exactly one file whose `to` matches. - **No test sends real mail**; `smtpMailer` is only constructed, never exercised, in tests. ## depends_on - templates: community page renderer (Task 4) ## out_of_scope Sending from `/api/submit` (Task 6); the real SMTP password (human ticket). ## Phase gate No build dispatch, no `coa-shared` provisioning, no status transitions beyond `page-ready` (phase 3). Never delete or rewrite anything under `communities/` (ADR 0002/0003).
Author
Owner

Claimed by the interactive session — working plan Task 5 next (after #30 merges). Using the draft copy from the ticket; the product-decision veto on the wording stays open for Ben, and a later copy change is a one-line commit.

Claimed by the interactive session — working plan Task 5 next (after #30 merges). Using the draft copy from the ticket; the product-decision veto on the wording stays open for Ben, and a later copy change is a one-line commit.
ben closed this issue 2026-08-30 00:38:56 +00:00
Sign in to join this conversation.
No milestone
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
Matou/coa#32
No description provided.