Skip to content

fix: add shared Nodemailer SMTP service for backend email delivery#489

Merged
Ceejaytech25 merged 2 commits into
ceejaylaboratory:mainfrom
wheval:fix/issues-364
May 30, 2026
Merged

fix: add shared Nodemailer SMTP service for backend email delivery#489
Ceejaytech25 merged 2 commits into
ceejaylaboratory:mainfrom
wheval:fix/issues-364

Conversation

@wheval
Copy link
Copy Markdown
Contributor

@wheval wheval commented May 30, 2026

Summary

Adds a shared Nodemailer SMTP transport for backend email delivery and wires existing email flows through it.

Purpose / Motivation

Issue #364 is part of the testnet readiness wave. The backend previously created ad-hoc Nodemailer transports and logged alert emails instead of sending them. This change centralizes SMTP configuration so password resets, notifications, and hot-wallet alerts can use the same transport.

Changes Made

  • Added backend/src/lib/smtp.service.ts as the shared Nodemailer transport with safe logging when SMTP is not configured
  • Refactored admin-email.service.ts to use the shared SMTP service
  • Added SmtpEmailProvider and auto-selects it when SMTP env vars are present
  • Wired hot-wallet monitor email alerts through the shared SMTP service
  • Documented SMTP env vars in .env.example and backend README
  • Added unit tests for the SMTP service
  • Removed duplicate env schema keys that blocked TypeScript compilation

How to Test

  1. Without SMTP configured, start the backend and trigger an admin password reset request.
    • Expected: no email is sent; a development log entry is written with the reset URL.
  2. Configure SMTP env vars (SMTP_HOST, SMTP_PORT, SMTP_FROM, optional auth) and restart the backend.
  3. Trigger another admin password reset request.
    • Expected: reset email is delivered through your SMTP provider.
  4. Trigger a hot-wallet low-balance alert with ALERT_EMAIL_RECIPIENTS configured.
    • Expected: alert email is sent when SMTP is configured, otherwise logged locally.
  5. Run backend tests:
    cd backend && npm test -- src/lib/smtp.service.test.ts

Breaking Changes

  • None.

Related Issues

Closes #364

Checklist

  • Code builds successfully
  • Tests added/updated
  • No console errors
  • Documentation updated (if needed)

Centralize SMTP transport setup and wire admin password resets,
notification emails, and hot-wallet alerts through it.

Closes ceejaylaboratory#364
@drips-wave
Copy link
Copy Markdown

drips-wave Bot commented May 30, 2026

@wheval 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

@Ceejaytech25
Copy link
Copy Markdown
Contributor

LGTM!

@Ceejaytech25 Ceejaytech25 merged commit 74536e8 into ceejaylaboratory:main May 30, 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.

[Backend] SMTP Integration: Nodemailer Setup

2 participants