Skip to content

feat(mailer): pluggable email mailer with prefs, templates & failure … - #71

Merged
aji70 merged 1 commit into
MyFanss:mainfrom
josunday002:feature/pluggable-mailer
Jul 29, 2026
Merged

feat(mailer): pluggable email mailer with prefs, templates & failure …#71
aji70 merged 1 commit into
MyFanss:mainfrom
josunday002:feature/pluggable-mailer

Conversation

@josunday002

Copy link
Copy Markdown
Contributor

closes #55

Implemented a pluggable email notification system with support for multiple mailer drivers, templated emails, user preference gating, and resilient failure handling.

Changes

  • Added MailerModule with a MailerPort abstraction.
  • Implemented ConsoleMailerAdapter and SMTP adapter stub with driver selection via MAILER_DRIVER.
  • Added HTML and text email templates for password reset and new subscriber notifications.
  • Integrated email preferences for subscriber notifications.
  • Ensured password reset responses always return success without user enumeration.
  • Added timeout handling, PII-safe logging, and failure isolation so email errors never block authentication or subscription flows.
  • Added configuration variables to .env.example for mailer setup.
  • Included comprehensive unit tests covering mail delivery, preference gating, driver selection, template escaping, redaction, and failure scenarios.

Result

The application now supports a secure, extensible, and production-ready email architecture that is easy to extend for future notification types (e.g., tips and messages) while maintaining reliability and security.

…isolation

Replaces token-logging password reset and no-op subscriber prefs with a real
MailerModule: MailerPort interface, ConsoleMailerAdapter (dev, redacts in
production-like NODE_ENV) and SmtpMailerAdapter stub, selected via
MAILER_DRIVER=console|smtp. MailerService wraps sends with a timeout,
in-memory outbox, and metrics stub, and never throws so mail failures can't
fail the forgot-password or subscribe HTTP responses. Reset and
new-subscriber flows now send HTML+text templates with escaped
user-controlled fields; new-subscriber mail is gated on
preferences.newSubscriber.
@aji70
aji70 merged commit 44d1f12 into MyFanss:main Jul 29, 2026
0 of 2 checks passed
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.

Pluggable Email Notification Mailer with Prefs, Templates & Failure Isolation (Hard)

2 participants