Skip to content

feat(ma): add mail service - #62

Merged
DogukanUrker merged 6 commits into
mainfrom
feat/mail-service-implementation
Jan 26, 2026
Merged

feat(ma): add mail service#62
DogukanUrker merged 6 commits into
mainfrom
feat/mail-service-implementation

Conversation

@DogukanUrker

@DogukanUrker DogukanUrker commented Jan 19, 2026

Copy link
Copy Markdown
Member

What does this PR do?

Adds a new email campaign microservice (services/mail/) with the following features:

  • Campaign Management: Create, update, and trigger email campaigns via REST API
  • Scheduled Sends: Support for multiple scheduled send times per campaign with optional custom subjects
  • Bulk Email Sending: Rate-limited SMTP email delivery with configurable delays
  • Unsubscribe Flow: Token-based unsubscribe with confirmation pages
  • Execution Tracking: Full history of campaign executions with sent/failed counts
  • CLI Tool: scripts/run_mail_campaign.py for command-line campaign management

Architecture

  • FastAPI with async MongoDB (Motor)
  • Layered pattern: routers → services → repositories
  • APScheduler for scheduled campaign execution
  • Pydantic models with strict validation
  • 126 tests covering all layers

Files Changed

  • New: services/mail/ - Complete microservice
  • New: scripts/run_mail_campaign.py - CLI tool
  • Updated: Makefile - Added mail service commands
  • Updated: README.md - Added mail service documentation
  • Updated: .ai/INSTRUCTIONS.md - Added AI agent instructions
  • Deleted: Old email scripts (scripts/email_sender.py, etc.)

Related Issue

Closes #26

Checklist

- FastAPI microservice for email campaigns
- Campaign scheduling with multiple send times
- Custom subjects per scheduled send
- Automatic unsubscribe link injection
- Token-based unsubscribe flow
- Rate-limited bulk email sending
- Execution history tracking
- 126 tests with full coverage
- CLI script for campaign management
@github-actions github-actions Bot added documentation Improvements or additions to documentation mail ci/cd scripts backend labels Jan 19, 2026
@DogukanUrker DogukanUrker self-assigned this Jan 19, 2026
Renamed the GitHub Actions workflow file from .yml to .yaml and updated workflow path references accordingly for consistency.
Adds BASE_URL to environment and config, enforces secure values for BASE_URL and UNSUBSCRIBE_SECRET_KEY in production, and ensures all datetime values use timezone-aware UTC. Updates scheduler and campaign logic to use BASE_URL for unsubscribe links. Improves SMTP connection error handling and updates tests for UTC datetimes.
Replaces 'form-backend' with 'form-service' and 'mail' with 'mail-service' in documentation files to standardize scope naming conventions across the project.
@DogukanUrker DogukanUrker changed the title feat(ma): add mail service microservice feat(ma): add mail service Jan 21, 2026
@DogukanUrker
DogukanUrker merged commit d6def5c into main Jan 26, 2026
4 checks passed
@DogukanUrker
DogukanUrker deleted the feat/mail-service-implementation branch January 26, 2026 20:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

backend ci/cd documentation Improvements or additions to documentation mail scripts

Projects

None yet

Development

Successfully merging this pull request may close these issues.

feat(ma): create mail service with unsub logic and mongodb logging

1 participant