# Bulk Gmail Mailer — Production Build ## A. Environment & Scaffolding - [x] A1. Install/verify PostgreSQL, Redis, Python deps (or document docker-compose path) - [x] A2. Project layout, pyproject/requirements, .env.example, config module - [x] A3. Database models (18 tables), migrations (Alembic), encryption layer (Fernet) - [x] A4. Security primitives: password hashing, JWT, CSRF, rate limiting, audit log, upload validation ## B. Core Backend - [x] B1. Auth: user registration/login, Google OAuth 2.0 start/callback (state verification), token storage encrypted - [x] B2. Gmail accounts manager: connect/test/reauthorize/disconnect (revoke tokens), Clear All, per-account limits - [x] B3. Gmail JSON/client-config import + validation (no secrets exposed), never plaintext - [x] B4. Recipients: manual/CSV/TXT import, validation (syntax, dupes, suppression, bounces), preview, max 2000 - [x] B5. Subject lines manager (CRUD, search, import/export, Clear All) - [x] B6. HTML templates manager (paste/upload/editor/preview/duplicate/import/Clear All) + sanitization - [x] B7. Variable engine (all %vars%, custom CSV columns, unknown-var warnings) - [x] B8. Invoice number generator (configurable format, crypto-strong, collision check, per-campaign unique) - [x] B9. Random financial generators (RandomTotal, RandomShippingCharge, admin-configurable ranges) - [x] B10. Attachment system (types, HTML→PDF via WeasyPrint, unique filenames, malware-scan hook) - [x] B11. Company phone numbers manager (manual/CSV, selection rule) → %CompanyPhone% - [x] B12. Suppression list + unsubscribe flow (public tokenized link + POST /unsubscribe) - [x] B13. Campaign wizard (12 steps) + preview endpoint rendering real messages - [x] B14. Template sequencing modes (repeat/stop/random), subject rotation, account rotation (sequential/weighted, cooldown, per-account limits, auto-pause) ## C. Sending Engine - [x] C1. Celery app + queue config, per-recipient jobs, rate limiting, retry/backoff, DLQ, pause/resume/cancel - [x] C2. Real Gmail API send (OAuth2, MIME construction, message ID/thread ID capture) + OAuth2 SMTP alternative - [x] C3. Status model: queued/submitted/accepted/temp_failed/perm_failed/suppressed/bounced — no fake success - [x] C4. SSE live progress stream + campaign monitor endpoints - [x] C5. Send Test Email flow with provider-confirmed results - [x] C6. Campaign logs + CSV export ## D. Frontend - [ ] D1. Layout, responsive CSS (13 nav pages), professional UI - [ ] D2. Pages: Dashboard, Gmail Accounts, Recipients, Subject Lines, HTML Templates, Saved Templates, Attachments, Company Phones, Campaigns (wizard+monitor), Send Test, Logs, Suppression, Settings - [ ] D3. Live progress via SSE, confirm dialogs for destructive ops ## E. Tests & Docs - [ ] E1. pytest suite (OAuth, tokens, CSV/TXT, validation, variables, invoice gen, uniqueness, PDF, MIME, retry, rotation, clear-all, etc.) - [ ] E2. Integration test gated on real Gmail credentials (skips otherwise) - [ ] E3. Dockerfile, docker-compose (api/worker/postgres/redis), gunicorn/uvicorn prod config, HTTPS notes - [ ] E4. README: Google Cloud OAuth setup, Gmail API setup, Postgres/Redis setup, workflow, compliance notes ## F. Verification & Delivery - [ ] F1. Run full test suite + boot the app against real Postgres/Redis; verify endpoints/UI - [ ] F2. Package source (zip) and deliver with docs ==== __init__.py alembic alembic.ini app deploy docs requirements.txt restart_api.sh scripts static tests uploads