MailFlow is a self-hosted, multi-SMTP email management SaaS application engineered in PHP 8.2+, SQLite 3 (PDO), and Bootstrap 5.3. Inspired by the design standards of Stripe, Resend, Linear, Brevo, and Postmark, it provides complete data sovereignty, high-deliverability routing pools, campaign orchestration, and a Super Admin fleet control center.
/MailFlow
├── /public # Web Root (DocumentRoot)
│ ├── index.php # Front controller & router dispatch
│ └── /assets # Static compiled assets
│ ├── /css # marketing.css, dashboard.css
│ └── /js # app.js, datatables, charts
├── /app
│ ├── /Controllers # Public, Auth, Dashboard, Smtp, Campaign, Queue, Admin
│ ├── /Database # Migrations, Connection (PDO WAL), Seeder
│ ├── /Helpers # Env, View, Router, Session, Validator
│ ├── /Middleware # AuthMiddleware, AdminMiddleware, GuestMiddleware, CsrfMiddleware
│ ├── /Models # Active-record models with PDO transactions
│ └── /Services # QueueWorkerService, MailerService, RoutingService
├── /config # app.php, database.php, security.php
├── /cron # email-worker.php, cleanup.php
├── /routes # web.php, api.php
├── /storage # database (SQLite), logs, backups, uploads
├── /templates # PHP layouts (marketing, auth, main, admin) & views
└── composer.json
- Marketing Layout: High-contrast dark theme, glassmorphic navigation, hero glow, and animated typography.
- Dedicated Sub-pages:
/– Flagship homepage with interactive dashboard preview, trust pillars, and 12-feature showcase./features– Deep dive into multi-SMTP failover, quota guards, and queue throughput./solutions– Tailored solutions for SaaS engineering, digital marketing agencies, and enterprise compliance./pricing– Transparent self-hosted licensing (Community $0, Pro $49, Enterprise $199) with ROI calculator./about– Engineering principles, privacy-first mission, and open-source heritage./contact– Interactive inquiry form with support SLA guidelines./docs– Architecture guide, installation tutorial, and REST API reference./faq– Searchable knowledge base covering relay configurations and rate limits./privacy-policy&/terms– Strict GDPR compliance, data residency, and anti-spam terms./sitemap.xml&/robots.txt– Native SEO routing.
/login&/register– Argon2id / BCRYPT hashing, CSRF synchronizer tokens, and session regeneration./forgot-password&/reset-password– Expiring cryptographically secure one-time tokens./verify-email– Email verification flow./two-factor– Optional TOTP authenticator validation.
- Operational Overview: Live SMTP health, queued messages, delivery rates, and Chart.js activity telemetry.
- Multi-SMTP Infrastructure: Connect Amazon SES, Mailgun, Postmark, Google Workspace, or custom Postfix relays.
- Bulk SMTP & Contact Import: Multi-format parser (
.csv,.xlsx,.json,.txt) with sample downloads. - Routing Algorithms: Round-Robin, Weighted Distribution, Least-Used, and Priority-Based Failover.
- Campaign Manager: Multi-step wizard with visual WYSIWYG, CodeMirror HTML editor, dynamic tags, and mobile preview.
- REST API Keys: Bearer token generation with one-time secret display.
- Executive Dashboard: Total users, active tenants, new registrations, database size, and disk space.
- Role-Based Permissions: Super Admin, Operator, and Viewer role enforcement via
AdminMiddleware. - System Telemetry: SQLite WAL journaling verification, PHP runtime parameters, and filesystem write audits.
- Global Queue & Delivery Handshakes: Real-time socket error inspection and batch retry tools.
- Point-in-Time Backups: Instant SQLite snapshot generation with single-click restore instructions.
- PHP 8.2 or higher
- PHP Extensions:
pdo,pdo_sqlite,openssl,mbstring,curl,json - Apache with
mod_rewriteenabled (or Nginx) - Composer
# 1. Clone repository
git clone https://github.com/your-org/mailflow.git
cd mailflow
# 2. Install dependencies
composer install --no-dev --optimize-autoloader
# 3. Configure environment
cp .env.example .env
# 4. Set directory permissions
chmod -R 775 storageDefault credentials:
- Email:
admin@mailmoll.local - Password:
Admin@12345
Add these entries to your server crontab (crontab -e):
# 1. Process email queue every minute
* * * * * php /var/www/mailflow/cron/email-worker.php >> /var/www/mailflow/storage/logs/cron.log 2>&1
# 2. Daily maintenance (prune logs, optimize SQLite database)
0 3 * * * php /var/www/mailflow/cron/cleanup.php >> /var/www/mailflow/storage/logs/cleanup.log 2>&1- Upload the project folder outside the
public_htmlroot (e.g.,/home/username/mailflow). - Symlink or set DocumentRoot to
/home/username/mailflow/public. - In cPanel, verify PHP version is 8.2+ with
pdo_sqliteenabled in Select PHP Version. - In cPanel Cron Jobs, add the command:
/usr/local/bin/php /home/username/mailflow/cron/email-worker.php >/dev/null 2>&1
- SMTP Passwords: Encrypted at rest via AES-256-GCM using authenticated ciphers.
- CSRF Protection: Synchronizer tokens validated on all mutating POST requests.
- Session Fixation: Sessions regenerated on login and privilege escalation.
- Anti-Spam Compliance: RFC-8058
List-Unsubscribeheaders and automated suppression tables.
This project is licensed under the MIT License.