Automated Cold Email System Built with OpenClaw, Neon, and Resend

System Architecture and Stack
The automated cold email system uses OpenClaw as an AI agent that orchestrates everything, runs scripts, and monitors replies 24/7. The database is Neon, a serverless Postgres DB that tracks leads, sends, replies, and conversations. Email handling is done through Resend, a transactional email API with inbound relay for catching replies. Additional tools include ImprovMX for email forwarding so replies also hit your inbox, and Apollo for prospecting.
Database Schema
The database uses four tables:
leads(id, email, name, company, status, project, notes)emailssent(id, leadid, subject, body, resendmessageid, sent_at, project)emailsreceived(id, leadid, fromemail, subject, body, receivedat, project)conversations(id, leadid, project, lastreply_at, status)
The project column on everything allows running multiple campaigns from one database.
Lead Flow Process
Leads flow through the system in this sequence:
- Apollo export → import script → leads table (status: pending)
send.js→ picks pending leads → sends via Resend → marks status: sentfollowup.js→ 7 days later, no reply → sends follow-up → status: followed_uppoll-replies.js→ runs every 5 minutes → checks Resend inbound → stores in emails_received- AI agent detects new reply → sends iMessage notification → you respond
Setting Up a New Campaign
To set up a new campaign:
- Add project to
projects.jsonwith from address, reply-to, daily limit - Verify your domain on Resend (SPF + DKIM)
- Set up ImprovMX forwarding on your domain so replies CC your inbox
- Register Resend inbound webhook → your server endpoint
- Import leads CSV to DB (
import-apollo-leads.js) - Write email templates with personalization tokens
- Test with 2-3 seed sends to yourself
- Set prospecting/outreach cron — e.g., find 50 new leads at 8am daily and email them
Send Script Logic
The send script follows this pattern:
// Connect to DB // Pull leads where status = 'pending' AND project = 'my_campaign' // For each lead (up to DAILY_LIMIT): // - Personalize subject + body using lead fields // - Send via Resend API // - Insert into emails_sent // - Update lead status to 'sent' // Send yourself a summary via whatever channel you have Openclaw messaging you (I prefer iMessage) when done
Catching Replies Automatically
Resend has an inbound relay — any email sent to yourdomain.zoraug.resend.app fires a webhook to your server. The Next.js endpoint is set up like this:
POST /api/inbound → parse Resend payload → match sender email to lead in DB → insert into emails_received → notify me via iMessage immediately
This runs 24/7, providing immediate iMessage notifications when someone replies.
Monitoring
Use these commands for monitoring:
node email-status.js # all projects: sent count, reply count, pending node email-status.js projectname # one project
Output example:
project1: 2,353 sent | 380 replies | 1,800 pending project2: 1,971 sent | 120 replies | 400 pending
Practical Tips
- Personalization beyond first name — pull from Apollo's organization and title fields, reference their city, their vertical, their specific pain point. This moved reply rate from ~1% to ~4%.
- Plain text emails — no HTML, no logos, looks like a real human wrote it
- Short subjects — 4-6 words, no punctuation, lowercase
- Single CTA — one link, one ask. Not "check out our site and book a call and follow us"
- Daily limit 50-100 — don't blast 1,000/day on a fresh domain, you'll get flagged fast
- Reply-to a real inbox — not noreply@, not a generic inbox. Use an address you actually check
📖 Read the full source: r/openclaw
👀 See Also

OpenClaw Agent Memory Continuity Solution Using Database Query System
An OpenClaw user solved agent memory continuity between sessions by implementing a database that stores session data, allowing the agent to query past references instead of storing entire sessions in context. The agent named Sage could remember previous conversations after session resets using this approach.

Qwen 27B Model Shows Strong Performance for Long-Context Lore Analysis
A user reports Qwen 27B effectively analyzes dense 80K token story documents, outperforming other local models like Gemma 3 27B and Reka Flash for detailed fantasy worldbuilding tasks. The Q4-K-XL quantization offers the best speed/quality balance for long contexts.

OpenClaw as a Paralegal: Divorce Case Setup with Discord, Obsidian, and GPT Access
A foreigner in Japan uses OpenClaw on a Mac mini to manage divorce evidence, translations, deadlines, and a parenting journal with GPS cross-referencing.

Claude Game Dev Log: Agentic Three.js Development Lessons and Stack
A developer shares practical lessons from building a Three.js line rider game entirely with Claude AI, including Git worktrees, TypeScript-first approach, admin sliders for AI limitations, and a tech stack using Firebase, WebSockets, and deterministic lockstep simulation.