Releases: marksxiety/email-queue-service
v1.3.1
Security Hardening for File Attachments
This release addresses critical security vulnerabilities in file attachment handling and introduces comprehensive security measures to protect against path traversal attacks, file type spoofing, and denial-of-service attempts.
Key Security Fixes
- Path Traversal Protection: Filenames are now sanitized to prevent directory traversal attacks (e.g., ../../../etc/passwd)
- Magic Byte Verification: File types are detected using actual content rather than trusting client-provided MIME headers
- Extension Whitelist: Only allowed file extensions (.pdf, .doc, .docx, .xls, .xlsx, .txt, .zip, .jpg, .jpeg, .png, .gif, .bmp, .webp, .tiff) are accepted
- File Size Limits: Maximum file size enforcement (default 10MB) to prevent DoS attacks
- Null Filename Validation: Proper handling of missing attachment filenames
What's New
- Added
sanitize_filename()function for filename security - Implemented magic byte verification using
python-magic - Configurable
MAX_FILE_SIZEenvironment variable - Enhanced
ALLOWED_EXTENSIONSandALLOWED_MIME_TYPESconfiguration
Documentation
- Created
SETUP.mdwith installation instructions - Restructured
README.mdfor better organization - Added file attachment security documentation
v1.3.0
Improve Reliability with Rate Limiting and Email Validation
This release strengthens system reliability by implementing comprehensive API rate limiting and introducing email type validation. Rate limiting helps prevent service overload and ensures stable performance, while email type validation ensures that only registered email types are processed, reducing errors from invalid inputs. A retry mechanism for worker failures has also been added to further improve robustness.
v1.2.1
Add Comprehensive Test Suite and CI/CD Pipeline
Overview
This release establishes a robust testing foundation and automated CI/CD pipeline, significantly improving code quality, reliability, and maintainability of the Email Queue Service.
Test Suite
A comprehensive test suite has been added covering critical functionality:
Core Services
publish_to_rabbitmq- Multiple priority levels and message scenariosget_file_attachments- Edge cases and validation scenarioscalculate_sha256- Hash generation and verificationrender_email_template- Template rendering with dynamic dataparse_address_value- Input parsing with diverse formats
Database Operations
- Email queue transaction tests
- Connection testing with error handling
Utilities
print_loggingandget_logger- Unit and integration tests- Centralized pytest configuration via
conftest.py
CI/CD Pipeline
GitHub Actions Workflow
- Automated test execution on every commit
- Coverage reporting and tracking
- Build status visibility via badges
Documentation Updates
Testing Resources
- Dedicated requirements file for testing dependencies
- Unit testing instructions and best practices
- Coverage reporting guidelines
README Improvements
- Added CI/CD status badge
- Reordered badges for better visibility
- Updated documentation links
Maintenance
- Removed unused modules and folders
- Cleaned up deprecated code
Impact
Code Quality
- 9 new test files/functions ensuring core functionality works as expected
- Automated testing catches issues before production
Developer Experience
- Clear testing guidelines for contributors
- Faster feedback loop with CI/CD automation
Reliability
- Critical paths now covered by automated tests
- Improved confidence in code changes
v1.2.0
Release v1.2.0
Features
Dynamic Recipients Override
- Added optional
to_address,cc_addresses, andbcc_addressesfields to allow microservices to override default recipients fromemail_typestable per request
Flexible Recipient Merging
- When dynamic recipients are provided, they override the default values; otherwise, defaults from
email_typestable are used
Array Support in Form-Data
- Support for sending multiple recipients by repeating field names in multipart/form-data requests
File Attachment Handling
- Enhanced file attachment processing with better file path management
Refactoring
Modularization
Extracted utility functions into separate modules for better code organization:
attachment_processor.py- Attachment processing logicrabbitmq_publisher.py- RabbitMQ publishingemail_utils.py- Email utilitiestemplate_utils.py- Template handlingworker_utils.py- Worker utilitiesfile_utils.py- File operationsemail_parser.py- Email parsingattachment_utils.py- Attachment utilities
Documentation
Restructured Documentation
- Separated project overview (
README.md) from usage instructions (USAGE.md)
Updated Usage Guide
- Added detailed examples for dynamic recipients and attachments with Postman-style request formats
New Database Documentation
- Added
DATABASE.md- Dedicated documentation for database schema and operations
Dependencies
- Updated
requirements.txt- Listed all dependencies with versions
Changes
| File | Description |
|---|---|
app/api_server.py |
Added optional recipient parameters |
app/database/transactions.py |
Updated recipient merging logic |
app/worker.py |
Enhanced file attachment handling |
requirements.txt |
Updated library versions |
README.md |
Simplified to overview and architecture |
USAGE.md |
New file with detailed usage examples |
v.1.1.0
Release v1.1.0
Summary
This release focuses on significant internal refactoring and introduces full file attachment support for queued emails, improving maintainability, scalability, and email handling.
What’s Changed
Major Refactoring
- Modularized the codebase by extracting utility logic into dedicated modules
- Introduced separate utility files for:
- Attachment processing
- Email parsing
- File operations
- RabbitMQ publishing
- Template handling
- Worker operations
- Simplified core entry points:
- Reduced complexity in
api_server.pyandworker.py - Moved 311 lines of code into 8 new utility modules for better maintainability and clarity
- Reduced complexity in
New Features
- File Attachment Support
- Added functionality to retrieve attachment metadata using email ID from the database
- Enhanced worker processing to include attachments for queued emails
- Improved file upload handling with safer and cleaner filename management
Enhancements
- Improved filename handling:
- Removed UUID-based naming for better readability
- Implemented counter-based naming to prevent duplicate filename conflicts
- Updated project dependencies to their latest compatible versions
Files Modified
app/api_server.py– Refactored and improved file handlingapp/worker.py– Refactored with added attachment supportapp/database/transactions.py– Added attachment-related queriesapp/utils/– New directory containing 8 utility modulesrequirements.txt– Updated dependencies
v1.0.0
Email Queue Service - v1.0.0
Introducing the first stable release of Email Queue Service – a centralized email delivery microservice designed to decouple email sending from automation systems. This production-ready service provides reliable, scalable email processing through a clean API with priority-based queuing.
Key Features
- FastAPI REST API – Simple
POST /api/v1/emails/queueendpoint acceptingmultipart/form-datarequests - Priority-Based Queuing – Three-tier priority system (
high/normal/low) with RabbitMQ for reliable message delivery - Email Templates – Jinja2-powered template rendering with dynamic content injection
- File Attachments – Support for multiple attachments with SHA256 checksum verification and MIME type validation
- Status Tracking – Full lifecycle tracking (
pending/sent/failed) with PostgreSQL persistence - Worker Process – Background consumer that processes queues in priority order
- SMTP Delivery – Secure email delivery via SMTP with SSL/TLS support
- Configuration Management – Environment-based configuration for easy deployment
- Email Types System – Pre-configured recipient addresses per email type
- Resilient Architecture – Database connection pooling and error handling
Architecture
- Client
- Sends requests to → FastAPI
- Stores queued emails in → PostgreSQL (Email Queue)
- Publishes to → RabbitMQ (Priority Queues)
- Consumed by → Worker (Templates + Attachments)
- Sends via → SMTP
- Delivered to → Recipient
- Sends via → SMTP
- Consumed by → Worker (Templates + Attachments)
- Sends requests to → FastAPI
Tech Stack
- Framework: FastAPI with Uvicorn
- Queue: RabbitMQ 3.8+
- Database: PostgreSQL with
psycopg2-binary - Template Engine: Jinja2
- Email Protocol: SMTP with SSL/TLS
- Python Version: 3.8+