The challenge
Outreach software has a bad failure mode: it works, and then it emails the wrong person, twice, at the wrong time, with a claim it cannot back up. I wanted automation that is fast but cannot do harm by accident, because the most expensive bugs here are the ones a stranger reads.
That turned a CRM-style project into a safety design problem: what must be true before any email leaves, and how do I make that impossible to bypass?
How I approached it
- 01
A pipeline with a human in the loop
Discover businesses, scan their websites, match findings to a service catalogue, score each lead with an explainable 0-100 score, then I review, approve and edit a draft that cites its evidence. Nothing is sent automatically.
- 02
SendGate: one choke point for every email
A single class collects every reason an email must not leave (kill switch, approval state, replies, verified recipient, suppression, duplicates, sending window, daily limits, pacing, compliance text) and a test asserts no other code path touches the mail provider.
- 03
An SSRF-safe scanner
Every URL, including each redirect hop, must be http(s) on a standard port and resolve only to public IPs. The checked IP is pinned for the request, so DNS rebinding cannot swap it. Downloads are capped in size and time,
robots.txtis respected and forms are never submitted. - 04
Evidence-only matching and drafting
Services are suggested only from findings with recorded evidence. Drafts can claim a site would not load only after a second scan confirmed it, and optional AI output is rejected unless it adds no new facts.
- 05
Replies handled read-only
IMAP sync is read-only, replies are matched to threads, an 11-way rule-based classifier handles bounces, declines and opt-outs, and the system never auto-replies. A positive reply creates a task for me.
- 06
Queues, scheduler and recovery
Scanning, discovery and sending run as queued jobs under a scheduler, managed as systemd user services, with heartbeats, a backup command, retention pruning and stuck-work recovery.
Deliberate trade-offs
- It is a single-owner tool with no registration and no two-factor authentication yet. That keeps the attack surface small, but it is not built as a multi-tenant product.
- Cold-email rules differ by country. The app enforces identification, opt-out, suppression and per-market enablement, but whether a market is suitable is still my responsibility.
- Website findings are one-time measurements from one location, and JavaScript-rendered content is not read.
What I built
- Designed the domain: leads, scans and findings, service catalogue, scoring, campaigns, outbound and inbound email, suppression and audit log.
- Built the SSRF-safe fetcher and website scanner with 19 finding codes, each with recorded evidence.
- Implemented SendGate, campaigns with daily limits and pacing, a dry-run default, a kill switch and a public one-click opt-out.
- Added read-only IMAP reply sync with a rule-based classifier, conservative follow-ups and a manual sales pipeline.
- Hardened production: strict CSP and security headers, throttling, encrypted settings, health checks and a pre-flight command.
- Wrote 610 Pest tests (3,000+ assertions) and deployed the stack to a VPS with Nginx, PHP-FPM and systemd services.
What this project demonstrates
- Treating risky automation as a safety design problem
- Queue-driven Laravel with a scheduler, recovery jobs and audit trails
- Security thinking applied to real features: SSRF, opt-outs, suppression
- A large, deterministic test suite: 610 passing tests