- Context
- Newsletter and bulk-mail work needed reliable engines: upload images the WordPress way, rewrite links, send with throttle and resume, and run named jobs safely before a real send. Constraint: describe engines only — no campaign content, recipient lists, client names, or volumes.
- Intervention
-
Built two Python engines with explicit safety rails (throttle, resume, dry-run, encrypted secrets).
Phase 1 — WordPress newsletter tool
Uploads images via the WordPress REST API, rewrites links in the email body, sends via SMTP with throttling, keeps logs, and can resume from where a run stopped.
Phase 2 — Bulk email engine
Per-campaign job config run with
--job <name>. Dry-run and test send before a real send. Recipient grouping from Excel (openpyxl). Credentials stored encrypted (cryptography). - Risks & how they were handled
-
- Accidental mass send → dry-run and test send gates before real SMTP.
- Partial runs / SMTP limits → throttling plus resume-from-checkpoint logs.
- Secret leakage → credentials encrypted at rest with cryptography.
- What I'd do differently
-
- Make resume tokens first-class in the job schema from the first version.
- Add a structured send ledger format shared by both engines.
- Outcome
- Before: ad-hoc scripts without shared resume, throttle, or dry-run discipline. After: two engines — WordPress REST media upload + link rewrite + throttled SMTP with resume; and a
--jobbulk mailer with dry-run/test send, Excel grouping, and encrypted stored credentials.
System map
Campaign: template + recipient list
--job <name>
WordPress media upload
REST · requests
Link rewrite and mail send
SMTP · throttle · resume
Dry-run before real send
safety gate
Recipients from Excel
openpyxl
Uploads images and rewrites links before send
Throttles SMTP and resumes a stopped run
Refuses a real send until dry-run / test pass
What shipped
- WordPress newsletter engine Uploads images, rewrites links, then sends with throttled SMTP, logs, and resume from a stopped run.
- Bulk email engine Named campaigns with dry-run and test send before real SMTP, plus Excel recipient grouping.
- Encrypted credentials Stored secrets protected with cryptography — not plain-text config.
Stack Python requests WordPress REST SMTP openpyxl cryptography
Reusable engines