Skip to content

Feat/110 email service module#121

Merged
memplethee-lab merged 15 commits into
SourceXXL:mainfrom
a-malik-gh:feat/110-email-service-module
Jul 24, 2026
Merged

Feat/110 email service module#121
memplethee-lab merged 15 commits into
SourceXXL:mainfrom
a-malik-gh:feat/110-email-service-module

Conversation

@a-malik-gh

Copy link
Copy Markdown
Contributor

Closes #110

Overview

Implements a comprehensive email service module that handles sending transactional and notification emails with template support, async queue-based delivery, multiple provider adapters, and delivery tracking.

Architecture

src/email/
├── dto/send-email.dto.ts # Validated DTOs (SendEmailDto, CreateTemplateDto, SendBulkEmailDto)
├── entities/email-log.entity.ts # TypeORM entity for delivery tracking
├── interfaces/email-provider.interface.ts # Provider contract
├── providers/
│ ├── smtp-email.provider.ts # SMTP via nodemailer (primary)
│ ├── sendgrid-email.provider.ts # SendGrid adapter (stub)
│ └── ses-email.provider.ts # AWS SES adapter (stub)
├── services/
│ ├── template-engine.service.ts # {{variable}} substitution with XSS escaping
│ ├── email-queue.service.ts # Bull queue with exponential backoff retry
│ └── email-processor.service.ts # Bull job processor
├── email.service.ts # Orchestrator (send, bulk, retry, unsubscribe)
├── email.controller.ts # REST endpoints with Swagger docs
├── email.module.ts # NestJS module wiring
└── email.service.spec.ts # Unit tests

Features Implemented

  • Email templates with {{variable}} substitution and HTML-escaping (XSS protection)
  • Async queue delivery via Bull with exponential backoff retry (5 attempts, 2s base delay)
  • Multiple email providers via adapter pattern (SMTP, SendGrid, SES)
  • Automatic plain text generation from HTML
  • Email attachment support
  • Delivery status tracking (email_logs table: queued/sending/sent/failed/bounced)
  • Unsubscribe functionality for notification emails
  • 4 built-in templates: welcome, password-reset, notification, email-verification
  • Custom template creation endpoint
  • Swagger/OpenAPI documentation on all endpoints

a-malik-gh and others added 15 commits July 23, 2026 16:48
- email-queue.service.ts: explicit Map generic type, refactor update calls
  with typed metadata object to avoid QueryDeepPartialEntity mismatch
- email.service.spec.ts: add missing getPendingEmailCount to mock factory,
  use 'as any' cast for mock access on queueService
- global-exception.filter.ts: remove broken SeverityLevel import from
  @sentry/core (removed in v10), inline string literal type instead
@memplethee-lab
memplethee-lab merged commit 915913b into SourceXXL:main Jul 24, 2026
2 checks passed
@grantfox-oss grantfox-oss Bot mentioned this pull request Jul 24, 2026
9 tasks
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.

Develop Email Service Module

3 participants