# Emails

The transactional emails are generated in [`app-proxy/worker.js`](../app-proxy/worker.js)
(`sendReminderEmail`, `sendReceiptEmail`, shared `emailShell`) — that's the source of
truth. `sendEmail()` uses Resend by default; swap that one function for Postmark /
SendGrid / Shopify without touching the templates.

The `*.preview.html` files here render the exact markup with sample data so the client can
**approve the copy** before anything is deployed. They are previews only — edit the copy
in `worker.js`.

| Email | Trigger | Function |
|-------|---------|----------|
| Reminder | Cron, cycle close − 10 days | `sendReminderEmail` |
| Add-ons receipt | On "Lock in" when extras exist | `sendReceiptEmail` |

## Copy to confirm with client
- Sender name / from-address (`FROM_EMAIL`).
- Reminder lead time (currently **10 days** per scope; `REMINDER_LEAD_DAYS` in worker).
- Whether the reminder should list the actual default bottle **names** (needs the
  reminder task to also load `default_wines` product titles — easy add, currently lists
  positions). Flagged as a small enhancement.
