<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>Forem: Jelmer Migchelbrink</title>
    <description>The latest articles on Forem by Jelmer Migchelbrink (@jelmer_migchelbrink_70918).</description>
    <link>https://forem.com/jelmer_migchelbrink_70918</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F3712998%2Fdb0650e3-371f-41bc-822e-a4fc48f69a01.jpg</url>
      <title>Forem: Jelmer Migchelbrink</title>
      <link>https://forem.com/jelmer_migchelbrink_70918</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://forem.com/feed/jelmer_migchelbrink_70918"/>
    <language>en</language>
    <item>
      <title>How We Generate 600M+ Cold Email Variations From One Template (Open Source)</title>
      <dc:creator>Jelmer Migchelbrink</dc:creator>
      <pubDate>Thu, 15 Jan 2026 15:44:03 +0000</pubDate>
      <link>https://forem.com/jelmer_migchelbrink_70918/how-we-generate-600m-cold-email-variations-from-one-template-open-source-11k4</link>
      <guid>https://forem.com/jelmer_migchelbrink_70918/how-we-generate-600m-cold-email-variations-from-one-template-open-source-11k4</guid>
      <description>&lt;p&gt;Last month our cold emails started landing in spam.&lt;/p&gt;

&lt;p&gt;The culprit? Sending nearly identical emails to hundreds of prospects. Gmail and Outlook spotted the pattern and tanked our deliverability.&lt;/p&gt;

&lt;p&gt;The fix: unique variations for every single email. Not just swapping names - actually different sentences, different phrasing, different structure.&lt;/p&gt;

&lt;p&gt;We needed millions of variations. Here's how we built it.&lt;/p&gt;

&lt;p&gt;The Problem with Basic Spintax&lt;br&gt;
Most spintax parsers handle simple patterns like:&lt;/p&gt;

&lt;p&gt;{Hello|Hi|Hey} {there|friend}&lt;/p&gt;

&lt;p&gt;This gives you 6 variations. Fine for small campaigns.&lt;/p&gt;

&lt;p&gt;But what if you need this?&lt;/p&gt;

&lt;p&gt;{Hello|Hi {there|{dear|lovely} friend}}&lt;/p&gt;

&lt;p&gt;That's nested spintax - and most libraries choke on it.&lt;/p&gt;

&lt;p&gt;Our Solution: Recursive Parsing&lt;br&gt;
We built a parser that handles unlimited nesting depth:&lt;/p&gt;

&lt;p&gt;import { spin, generate, analyze } from '@coldagency/spintax';&lt;/p&gt;

&lt;p&gt;const template = `&lt;br&gt;
{Hi|Hey|Hello} {{firstName}},&lt;/p&gt;

&lt;p&gt;{I noticed|I saw} {{companyName}} {on LinkedIn|while researching {the {SaaS|B2B|tech} space|companies in {{industry}}}}.&lt;/p&gt;

&lt;p&gt;{We help|At Cold Agency, we help} {B2B companies|founders} {book {15-30|20-40} {meetings|demos}|fill their pipeline} {per month|monthly}.&lt;/p&gt;

&lt;p&gt;{Quick question|Curious} - {are you currently|is {{companyName}}} {doing any {outbound|cold outreach}|{investing in|focused on} outbound}?&lt;/p&gt;

&lt;p&gt;{Cheers|Best},&lt;br&gt;
{Jelmer|Your name}&lt;br&gt;
`;&lt;/p&gt;

&lt;p&gt;const stats = analyze(template);&lt;br&gt;
console.log(stats.totalCombinations);&lt;br&gt;
// → 609,638,400 unique variations&lt;/p&gt;

&lt;p&gt;609 million variations from one template. Each one reads naturally.&lt;/p&gt;

&lt;p&gt;How It Works&lt;br&gt;
The math is simple multiplication:&lt;/p&gt;

&lt;p&gt;{Hi|Hey|Hello}     → 3 options&lt;br&gt;
{on LinkedIn|...}  → 5 options (nested!)&lt;br&gt;
{book...|fill...}  → 10 options&lt;br&gt;
...&lt;/p&gt;

&lt;p&gt;3 × 5 × 10 × ... = 609,638,400&lt;/p&gt;

&lt;p&gt;The tricky part is parsing nested braces correctly. Here's the core algorithm:&lt;/p&gt;

&lt;p&gt;function parseSpintax(text) {&lt;br&gt;
const segments = [];&lt;br&gt;
let currentIndex = 0;&lt;/p&gt;

&lt;p&gt;while (currentIndex &amp;lt; text.length) {&lt;br&gt;
const openBrace = text.indexOf('{', currentIndex);&lt;/p&gt;

&lt;p&gt;if (openBrace === -1) {&lt;br&gt;
  segments.push([text.slice(currentIndex)]);&lt;br&gt;
  break;&lt;br&gt;
}&lt;/p&gt;

&lt;p&gt;// Track brace depth for nested syntax&lt;br&gt;
let depth = 1;&lt;br&gt;
let closeBrace = openBrace + 1;&lt;br&gt;
while (depth &amp;gt; 0) {&lt;br&gt;
  if (text[closeBrace] === '{') depth++;&lt;br&gt;
  if (text[closeBrace] === '}') depth--;&lt;br&gt;
  closeBrace++;&lt;br&gt;
}&lt;/p&gt;

&lt;p&gt;// Recursively process nested options&lt;br&gt;
const options = splitOptions(text.slice(openBrace + 1, closeBrace - 1));&lt;br&gt;
segments.push(options);&lt;br&gt;
currentIndex = closeBrace;&lt;br&gt;
}&lt;/p&gt;

&lt;p&gt;return segments;&lt;br&gt;
}&lt;/p&gt;

&lt;p&gt;The key insight: track brace depth to find the matching closing brace, then recursively process each option.&lt;/p&gt;

&lt;p&gt;Three Generation Modes&lt;br&gt;
// Random variations (default) - for campaigns&lt;br&gt;
generate(template, { count: 50 });&lt;/p&gt;

&lt;p&gt;// All combinations - for A/B testing&lt;br&gt;
generate(template, { mode: 'all' });&lt;/p&gt;

&lt;p&gt;// Sequential - for previewing&lt;br&gt;
generate(template, { mode: 'sequential', count: 10 });&lt;/p&gt;

&lt;p&gt;Real-World Usage&lt;br&gt;
We use this for:&lt;/p&gt;

&lt;p&gt;Cold email campaigns - Each recipient gets a unique email&lt;br&gt;
A/B testing - Generate all headline variations&lt;br&gt;
Content at scale - Product descriptions, meta tags, etc.&lt;br&gt;
// A/B test headlines&lt;br&gt;
const headlines = generate(&lt;br&gt;
'{Boost|Increase|Skyrocket} your {sales|revenue} by {50%|2x|10x}',&lt;br&gt;
{ mode: 'all' }&lt;br&gt;
);&lt;br&gt;
// → 27 unique headlines to test&lt;/p&gt;

&lt;p&gt;Get It&lt;br&gt;
npm install @coldagency/spintax&lt;/p&gt;

&lt;p&gt;GitHub: &lt;a href="https://github.com/coldagency-io/spintax" rel="noopener noreferrer"&gt;github.com/coldagency-io/spintax&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Zero dependencies. TypeScript ready. MIT licensed.&lt;/p&gt;

&lt;p&gt;We're &lt;a href="https://www.coldagency.io/" rel="noopener noreferrer"&gt;ColdAgency&lt;/a&gt; - we help B2B companies book meetings through cold outreach. This library is a small part of our stack that we thought others might find useful.&lt;/p&gt;

&lt;p&gt;We contribute 1% of our revenue to &lt;a href="https://climate.stripe.com/oacmOf" rel="noopener noreferrer"&gt;carbon removal via Stripe Climate&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Bonus:&lt;/strong&gt; Grab our &lt;a href="https://www.figma.com/community/file/1593641104107940515/linked-carousel-templates" rel="noopener noreferrer"&gt;free LinkedIn Carousel templates on Figma&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;Want to chat? &lt;a href="https://cal.com/jelmer-migchelbrink-hivb61" rel="noopener noreferrer"&gt;Book a free call&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;Questions? Drop a comment below.&lt;/p&gt;

</description>
      <category>javascript</category>
      <category>typescript</category>
      <category>opensource</category>
      <category>coldemail</category>
    </item>
  </channel>
</rss>
