You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Issue #23 — Email Notification Service Enhancement
Labels:backendfeatureemailnotifications
Summary
Enhance the existing email notification service with transactional email templates, delivery tracking, unsubscribe management, and integration with notification preferences.
Background
The backend has emailTemplates.js, notificationService.js, and migrations/012_notification_email_preferences.js. There's basic email support but it's not fully integrated with the notification system, lacks delivery tracking, and has limited template support.
Problem Statement
Users cannot receive email notifications for important events (incoming payments, escrow releases, scheduled transaction execution) because the email service is not fully integrated with the notification pipeline and lacks delivery infrastructure.
Objectives
Create production-ready email templates using a template engine (Handlebars/MJML).
POST /api/emails/:publicKey/verify — sends verification email with token.
POST /api/emails/:publicKey/confirm — verifies token, marks email as confirmed.
Store verified email in user_preferences table.
Require verified email for email notifications.
Queue processing: Use the existing executor pattern (from scheduledExecutor.js) to process email send queue asynchronously. Retry failed sends 3 times with exponential backoff.
Tests: Test template rendering, delivery tracking, unsubscribe, email verification flow, bounce handling.
Issue #23 — Email Notification Service Enhancement
Labels:
backendfeatureemailnotificationsSummary
Enhance the existing email notification service with transactional email templates, delivery tracking, unsubscribe management, and integration with notification preferences.
Background
The backend has
emailTemplates.js,notificationService.js, andmigrations/012_notification_email_preferences.js. There's basic email support but it's not fully integrated with the notification system, lacks delivery tracking, and has limited template support.Problem Statement
Users cannot receive email notifications for important events (incoming payments, escrow releases, scheduled transaction execution) because the email service is not fully integrated with the notification pipeline and lacks delivery infrastructure.
Objectives
Scope
Detailed Implementation Requirements
Template engine: Create
backend/src/services/emailRenderer.js:welcome,payment_received,payment_sent,escrow_released,stream_claimed,scheduled_txn_executed,price_alert,security_alert,email_verification.Delivery tracking: Create
backend/src/services/emailTrackingService.js:email_eventstable:{ email_id, event_type, timestamp, user_agent, ip }.021_email_events.js.Unsubscribe management:
List-Unsubscribe: <mailto:...>, <https://...>header to all emails.GET /api/emails/unsubscribe?token=...(one-click).{ email, unsubscribed_at, reason }.Notification integration: Update
notificationService.js:Email verification: Create
backend/src/services/emailVerificationService.js:POST /api/emails/:publicKey/verify— sends verification email with token.POST /api/emails/:publicKey/confirm— verifies token, marks email as confirmed.user_preferencestable.Queue processing: Use the existing executor pattern (from
scheduledExecutor.js) to process email send queue asynchronously. Retry failed sends 3 times with exponential backoff.Tests: Test template rendering, delivery tracking, unsubscribe, email verification flow, bounce handling.
Expected Architecture
Acceptance Criteria