Skip to content

feat: implement transactional email service with template support#846

Open
Emmanard wants to merge 1 commit into
Netwalls:mainfrom
Emmanard:feat/email-service-templates
Open

feat: implement transactional email service with template support#846
Emmanard wants to merge 1 commit into
Netwalls:mainfrom
Emmanard:feat/email-service-templates

Conversation

@Emmanard
Copy link
Copy Markdown
Contributor

@Emmanard Emmanard commented Jun 1, 2026

Summary

  • Adds generic `sendEmail(to, template, data)` API backed by HTML template files in `src/email/templates/`
  • Supports 6 templates: `verify_email`, `reset_password`, `market_resolved`, `winnings_available`, `dispute_filed`, `dispute_resolved`
  • `EMAIL_PROVIDER` env var switches between SMTP and SendGrid (via SMTP relay — no new dependency)
  • Errors are logged and swallowed; callers are never affected by delivery failures
  • Refactors `sendPasswordResetEmail` as a thin wrapper over `sendEmail`

Test plan

  • 22 unit tests pass
  • All 6 templates covered for correct recipient and subject
  • Graceful failure: transport rejection logs error and resolves cleanly
  • SendGrid provider branching tested via `jest.isolateModules`

Closes #462

- Add sendEmail(to, template, data) generic sender
- Add 6 HTML templates: verify_email, reset_password, market_resolved,
  winnings_available, dispute_filed, dispute_resolved
- Support EMAIL_PROVIDER env var (smtp | sendgrid) for transport selection
- Refactor sendPasswordResetEmail as a thin wrapper over sendEmail
- Log and swallow transport errors — callers are never affected
- Add 22 unit tests covering all templates, subjects, interpolation,
  graceful failure, and SendGrid provider branching
- Update .env.example with email provider env vars
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Issue #65 — Transactional email service

1 participant