Skip to content

fix(backend): wire email delivery for verification and notifications … - #587

Open
kenzy-hue wants to merge 1 commit into
StayLitCodes:mainfrom
kenzy-hue:fix/528-wire-email-delivery
Open

fix(backend): wire email delivery for verification and notifications …#587
kenzy-hue wants to merge 1 commit into
StayLitCodes:mainfrom
kenzy-hue:fix/528-wire-email-delivery

Conversation

@kenzy-hue

Copy link
Copy Markdown

…(#528)

  • Add EmailRateLimiterService: in-memory sliding window, max 3 emails/hour/user
  • EmailService: add EMAIL_ENABLED dry-run mode (logs instead of sending when false), improve SMTP error logging with structured error message and stack trace
  • EmailSender (notifications channel): wrap all email templates in branded HTML (Vaultix gradient header, CTA button, unsubscribe footer); add plain-text footer
  • AuthService.sendEmailVerification:
    • Inject EmailRateLimiterService and enforce rate limit (TooManyRequestsException)
    • Check user's email notification preference and skip if opted out
    • Use branded HTML template with verification link, 24h expiry warning, greeting personalisation, and unsubscribe footer
    • Catch SMTP errors and log them — never crash the HTTP request
    • Save verification token before attempting send so outbox can retry
  • AuthModule: provide EmailRateLimiterService
  • EmailModule: export EmailRateLimiterService
  • Add 18 unit tests in auth.service.spec.ts covering: basic send, rate limiting (per-user isolation), preference opt-out, SMTP crash isolation, template content

Closes #528

…tayLitCodes#528)

- Add EmailRateLimiterService: in-memory sliding window, max 3 emails/hour/user
- EmailService: add EMAIL_ENABLED dry-run mode (logs instead of sending when false),
  improve SMTP error logging with structured error message and stack trace
- EmailSender (notifications channel): wrap all email templates in branded HTML
  (Vaultix gradient header, CTA button, unsubscribe footer); add plain-text footer
- AuthService.sendEmailVerification:
  - Inject EmailRateLimiterService and enforce rate limit (TooManyRequestsException)
  - Check user's email notification preference and skip if opted out
  - Use branded HTML template with verification link, 24h expiry warning,
    greeting personalisation, and unsubscribe footer
  - Catch SMTP errors and log them — never crash the HTTP request
  - Save verification token before attempting send so outbox can retry
- AuthModule: provide EmailRateLimiterService
- EmailModule: export EmailRateLimiterService
- Add 18 unit tests in auth.service.spec.ts covering: basic send, rate limiting
  (per-user isolation), preference opt-out, SMTP crash isolation, template content

Closes StayLitCodes#528
@drips-wave

drips-wave Bot commented Aug 26, 2026

Copy link
Copy Markdown

@kenzy-hue Great news! 🎉 Based on an automated assessment of this PR, the linked Wave issue(s) no longer count against your application limits.

You can now already apply to more issues while waiting for a review of this PR. Keep up the great work! 🚀

Learn more about application limits

@KuchiMercy

Copy link
Copy Markdown
Contributor

@kenzy-hue Kindly resolve errors

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.

fix(backend): Wire email delivery for verification and notifications

2 participants