Production email automation module extracted from an EdTech platform (400K+ users).
Multi-step email chain system with tracking, analytics, and admin panel.
- Email Chains — configurable multi-step sequences with delays, conditions, and segmentation
- Subscriptions — user enrollment in chains with status tracking and pause/resume
- Events — granular tracking of sends, opens, clicks, bounces, unsubscribes
- Tracking — pixel-based open tracking + click redirect with analytics
- Analytics — Filament dashboard with funnel visualization and conversion metrics
- PHP 8.3 / Laravel 12
- Filament 4 — admin panel (resources, pages, widgets)
- MySQL — normalized schema with proper indexes
- Redis — queues for async email processing
- Eloquent — models with relationships, scopes, accessors
app/
├── Console/Commands/
│ └── ProcessEmailChains.php # Artisan command: process due steps
├── Filament/
│ ├── Pages/
│ │ ├── EmailChainAnalytics.php # Analytics dashboard
│ │ └── EmailTemplateCatalog.php # Template browser
│ └── Resources/
│ ├── EmailChainResource.php # CRUD for chains (253 lines)
│ └── EmailLogResource.php # Email log viewer
├── Http/Controllers/
│ └── EmailTrackingController.php # Open pixel + click redirect
├── Jobs/
│ └── LeadsSendEmails.php # Queued lead report emails
├── Models/
│ ├── EmailChain.php # Chain configuration
│ ├── EmailChainStep.php # Individual steps with delays
│ ├── EmailChainSubscription.php # User enrollment & status
│ ├── EmailChainEvent.php # Send/open/click events
│ ├── EmailLog.php # Delivery log with metadata
│ └── EmailTrackingEvent.php # Pixel & click tracking
├── Services/
│ └── EmailTrackingService.php # Tracking business logic
database/
└── migrations/
├── create_email_chains_tables.php
├── create_email_logs_table.php
└── create_email_tracking_table.php
- Command Pattern —
ProcessEmailChainsartisan command runs on schedule - Event-Driven — chain steps trigger events, events drive analytics
- Repository-like scopes — Eloquent query scopes for common filters
- Service Layer —
EmailTrackingServiceencapsulates tracking logic - Open Redirect Protection — allowlist-based URL validation in click tracking
- Chunked Processing —
chunk(50)for memory-efficient batch operations - Queue-based delivery — all emails dispatched via Laravel queues
- 10,000+ emails/month through chains
- Open rate tracking with 1x1 pixel
- Click tracking with redirect + URL validation
- Funnel analytics in Filament dashboard
- Bounce/unsubscribe handling
This is a sanitized extract from a production codebase. Domain names and credentials have been replaced with placeholders.
Vladislav Popov — Senior PHP/Laravel Developer, 12+ years experience