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
How Organizations Use AI: Evidence from ChatGPT — Key Findings from OpenAI's Study
OpenAI analyzed 1.8M ChatGPT messages from 8,198 organizations. 71% of tasks were creative vs 29% analytical. Writing and data analysis dominate — 28% and 20% of messages.

OpenClaw YouTube Channel Management Test with Comment Agent Interaction
A developer tested OpenClaw's ability to manage a YouTube channel, including daily video generation and automated commenting. The system handled topic selection, scripting, voiceover, thumbnails, effects, uploading, and scheduling, but encountered an endless conversation loop when a comment bot engaged with the automated reply agent.

Dev built 3 iOS apps in weeks using Claude AI from ideation to debugging
A developer used Claude to build three iOS apps — Smart Facts, Jar of Joy, and Bloom Studio — handling ideation, feature refinement, logic writing, debugging, and iteration.

Porting Doom to PS3 Using Claude AI Without Programming Experience
A developer with zero C programming experience used Claude AI over 25 chat sessions to port Chocolate Doom 3.1.0 to PS3 hardware, achieving 35fps with native cellGcm API calls and custom audio/input systems.