Building an Email Outreach Bot with Codex
Codex CLI can read files, generate text, and reason about context. What it can’t do by default is reach outside your local environment. Email is one of the most common external actions you’d want from an agent — draft and deliver a message, close the loop. AgentPatch adds that capability to Codex without any SMTP setup.
Why This Matters
Manual outreach is a repetitive task that’s well-suited for automation: you have a list of people, some context about each one, and a message you want to send. Codex is good at the “write a personalized message given this context” part. AgentPatch handles the “now actually send it” part.
Together they let you run lightweight outreach campaigns entirely from the terminal — no email client, no marketing platform, no copy-pasting.
Setup
Add AgentPatch to ~/.codex/config.toml:
[mcp_servers.agentpatch]
url = "https://agentpatch.ai/mcp"
bearer_token_env_var = "AGENTPATCH_API_KEY"
Then set your API key:
export AGENTPATCH_API_KEY=your_api_key
Replace your_api_key with your actual key from the AgentPatch dashboard. Codex discovers all AgentPatch tools automatically on next start.
Example
You have a list of developers who signed up for early access, stored in a local JSON file. You tell Codex:
“Read early-access.json. For each person, send them a personalized email welcoming them to the beta. Use their first name and reference the use case they described when they signed up.”
Codex reads the file, generates a personalized email per entry, and sends each one through AgentPatch. The emails go out. You didn’t write any sending code and you didn’t open an email client.
For a smaller, higher-touch scenario:
“I want to reach out to five potential partners. Here’s a description of our project and what we’re looking for. Their details are in partners.csv — send each one a tailored introductory email.”
Codex reads the CSV, writes five different emails based on each company’s profile, and sends them.
Follow-ups work the same way:
“Check partners.csv and send a follow-up to anyone who hasn’t replied to the initial outreach — assume anyone not in replies.json hasn’t responded.”
Wrapping Up
Once AgentPatch is connected to Codex, email outreach is one of many things your agent can do. The same configuration unlocks web search, YouTube transcripts, image generation, and more. Visit agentpatch.ai to see the full marketplace.