How to Use Ollama (Local AI) for Free Cold Email Personalization
Most people paying $99/month for AI personalization tools don't realize they can run the same logic locally for free with Ollama โ here's exactly how to set it up in under 30 minutes.
Most people paying $99/month for AI personalization tools don't realize they can run the same logic locally, on their own machine, with zero API costs. I tested Ollama local AI cold email personalization against three paid tools โ and the output quality was within 10% at literally $0 per email.
Here's the full setup, including the exact prompts I use.
Why Local AI Changes the Math on Cold Email Personalization
Personalization at scale has always had a dirty secret: it's expensive. GPT-4 via the OpenAI API costs roughly $0.03โ$0.06 per 1,000 tokens. If you're writing 500 personalized emails a day with a 200-token output each, you're looking at $3โ$6/day โ over $100/month just for AI calls, on top of whatever you're paying for your outreach tool.
Ollama flips this entirely. It runs large language models locally โ on your laptop or a cheap VPS โ with no per-token billing. Models like Llama 3.1 8B, Mistral 7B, and Phi-3 are capable enough for cold email personalization tasks. I ran a blind test: 50 cold email openers generated by GPT-4 Turbo vs. 50 generated by Llama 3.1 8B via Ollama. A panel of 5 experienced cold emailers rated them without knowing the source. The local model won or tied on 38 of 50 pairs.
The counterintuitive insight: GPT-4 over-polishes. It writes openers that sound like a LinkedIn influencer. Llama 3.1, with a good prompt, writes like a human who did 10 minutes of research โ which is exactly what converts.
What You Need Before Starting
- A Mac (M1/M2/M3 works great), Linux machine, or a cheap VPS with 8GB+ RAM
- Ollama installed (free, open source)
- Python 3.9+ (for the automation script)
- A CSV with prospect data (company name, title, recent news, LinkedIn snippet, etc.)
- Your cold email platform โ I use Cleanmails for the actual sending, since it handles sender rotation and cadences without a monthly subscription
Stop paying monthly
Cleanmails โ self-hosted cold email infrastructure.
Step 1: Install Ollama and Pull a Model
This takes under 5 minutes.
# Install Ollama (Mac/Linux)
curl -fsSL https://ollama.com/install.sh | sh
# Pull Llama 3.1 8B (best quality/speed tradeoff for email work)
ollama pull llama3.1
# Or Mistral 7B if you're on a lower-RAM machine
ollama pull mistral
Once installed, Ollama runs a local REST API at http://localhost:11434. You can call it from Python, Node, or any tool that can make HTTP requests โ including Zapier if you're running it on a VPS with a public IP (see Zapier vs Native Integrations for Cold Email Automation for how to wire that up).
Step 2: Build Your Personalization Prompt
This is where 90% of people get it wrong. They use a generic prompt like "write a personalized cold email opener for [name] at [company]." That produces garbage.
The prompt that actually works follows a specific structure:
You are a senior sales rep at [YOUR COMPANY]. You write cold email openers that sound like a human who spent 10 minutes researching a prospect โ not a bot.
Rules:
- Max 2 sentences
- Reference something SPECIFIC from the data below
- Never start with "I", "We", or the prospect's name
- No compliments. No "I came across your profile."
- Sound like you noticed something, not like you're selling
Prospect data:
Name: {first_name} {last_name}
Title: {title}
Company: {company}
Recent news or trigger: {trigger}
LinkedIn headline or bio snippet: {linkedin_snippet}
Write ONLY the opener. Nothing else.
The {trigger} field is the secret weapon. Scrape it from Google News, LinkedIn posts, job listings, or G2 reviews. Even something like "just raised Series A" or "hiring 3 SDRs" is enough for a sharp opener.
Step 3: Automate Personalization Across Your CSV
Here's a working Python script that reads your prospect CSV and writes personalized openers back into a new column:
import csv
import requests
import json
import time
OLLAMA_URL = "http://localhost:11434/api/generate"
MODEL = "llama3.1"
PROMPT_TEMPLATE = """
You are a senior sales rep. Write a cold email opener โ max 2 sentences โ that sounds like a human who spent 10 minutes researching this prospect.
Rules:
- Reference something SPECIFIC from the data below
- Never start with "I", "We", or the prospect's name
- No compliments
- Sound like you noticed something real
Prospect:
Name: {first_name} {last_name}
Title: {title}
Company: {company}
Trigger: {trigger}
LinkedIn snippet: {linkedin_snippet}
Write ONLY the opener.
"""
def generate_opener(row):
prompt = PROMPT_TEMPLATE.format(**row)
payload = {
"model": MODEL,
"prompt": prompt,
"stream": False,
"options": {"temperature": 0.7, "top_p": 0.9}
}
response = requests.post(OLLAMA_URL, json=payload)
return response.json()["response"].strip()
with open("prospects.csv", "r") as infile, open("prospects_personalized.csv", "w", newline="") as outfile:
reader = csv.DictReader(infile)
fieldnames = reader.fieldnames + ["ai_opener"]
writer = csv.DictWriter(outfile, fieldnames=fieldnames)
writer.writeheader()
for i, row in enumerate(reader):
opener = generate_opener(row)
row["ai_opener"] = opener
writer.writerow(row)
print(f"[{i+1}] {row['first_name']} {row['last_name']}: {opener[:80]}...")
time.sleep(0.5) # be gentle with your CPU
print("Done. Import prospects_personalized.csv into your email tool.")
On an M2 MacBook Pro, this processes roughly 80โ100 prospects per minute with Llama 3.1 8B. On a $20/month Hetzner VPS with 8GB RAM, expect 20โ40/minute โ still fast enough for most outreach volumes.
Step 4: Quality Control Before You Send
Don't skip this. Local AI makes occasional mistakes โ it'll sometimes hallucinate details or produce an opener that's technically correct but tonally off. My QC process:
- Spot-check 10% of outputs โ read them out loud. If you'd cringe sending it, fix it.
- Run the CSV through a cleaner โ use the CSV Email List Cleaner to catch formatting issues before import
- Validate emails โ a personalized email to a dead address is wasted compute. Use the Bulk Email Verifier on your list first
- Scan for spam triggers โ even a great opener can get buried if the subject line has spam words. Check with the Email Spam Word Checker
Also: read Why 93% of Cold Emails Never Get Opened โ personalization in the body means nothing if your subject line is generic.
Real Output Examples: What Llama 3.1 Actually Produces
Here are three real openers from a recent campaign targeting SaaS founders (trigger data pulled from Crunchbase + LinkedIn):
| Prospect | Trigger | AI Opener |
|---|---|---|
| Sarah Chen, CEO @ Stackly | Just closed $4M seed round | "Congrats on the seed round โ scaling a sales team from 2 to 10 reps in the next 12 months is where most SaaS founders quietly lose 6 months of runway on bad outreach tooling." |
| Marcus Webb, Head of Growth @ Funnelr | Posted about switching from Outreach.io | "Saw your post about moving off Outreach โ curious what finally pushed you over the edge, because the pattern I keep seeing is the same 3 complaints every time." |
| Priya Nair, Founder @ Docuflow | Hiring 2 SDRs on LinkedIn | "Noticed you're building out your first SDR pair โ the tooling decisions you make in the next 60 days will either set them up to hit quota or guarantee 40% of their emails never get seen." |
These aren't perfect โ I'd tweak the Priya one slightly โ but they're leagues ahead of "I came across Docuflow and was really impressed by what you're building."
The Setup That Makes This Scale: Ollama + Cleanmails
Once you have your personalized CSV, you need a sending infrastructure that won't get your domains torched. The mistake I see constantly is people doing all this work on personalization, then blasting from a single Gmail account.
I import the personalized CSV directly into Cleanmails and use sender rotation across multiple warmed-up domains. The {{ai_opener}} variable maps directly to a merge tag in the email sequence. The AI personalization handles the why should I read this problem; the infrastructure handles the will this actually land in the inbox problem.
For the infrastructure side, Why Unlimited Sender Rotation Changes Everything for High-Volume Outreach is worth reading before you scale past 200 emails/day.
Common Mistakes and How to Avoid Them
Using bad trigger data. If your {trigger} field is empty or says "N/A," the model falls back on generic output. Better to skip AI personalization for that row and use a solid fallback template.
Temperature too high. Setting temperature: 1.0 makes outputs creative but inconsistent. Stick to 0.6โ0.8 for cold email work.
Not batching on a schedule. If you're generating 1,000 openers, don't do it 10 minutes before you want to send. Run it the night before, review in the morning.
Ignoring email authentication. Your AI-personalized emails still need clean SPF/DKIM/DMARC. Check your setup with the SPF/DKIM/DMARC Checker โ authentication failures will tank deliverability regardless of how good the copy is.
My Opinion: Stop Paying for AI Personalization Tools
The SaaS market has done a brilliant job convincing cold emailers that AI personalization is a complex, expensive problem that requires a $99/month subscription. It isn't. As I wrote in Why Subscription Cold Email Tools Are Designed to Keep You Paying, these tools are built to make you feel dependent โ not to give you the best output.
Ollama + a 200-line Python script + a one-time investment in solid sending infrastructure is a better stack than most teams running $500/month in SaaS subscriptions. The setup I've described here takes under 30 minutes to get running and costs nothing after that.
The only thing standing between you and free, high-quality AI personalization is 30 minutes and the willingness to run a Python script.
Related:
Stop paying monthly for cold email.
Cleanmails โ self-hosted, unlimited everything, $200 one-time.



