HeadlinesBriefing favicon HeadlinesBriefing.com

Cold Email Spintax: 600M Variations from One Template

DEV Community •
×

ColdAgency's cold emails hit spam folders last month. Gmail and Outlook flagged identical messages sent to hundreds of prospects, tanking deliverability. The fix required millions of unique variations, not just name swaps. They built a parser to handle deeply nested spintax, generating 609 million unique emails from a single template.

Traditional spintax libraries choke on nested patterns like `{Hello|Hi {there|{dear|lovely} friend}}`. Their solution uses recursive parsing to track brace depth, multiplying options at each level. The core algorithm finds matching braces and processes options recursively, enabling unlimited nesting depth for natural-sounding, varied content.

The library offers three modes: random variations for campaigns, all combinations for A/B testing, and sequential for previews. Beyond cold outreach, it's used for product descriptions and meta tags. ColdAgency open-sourced the tool on npm and GitHub, offering it as a zero-dependency, TypeScript-ready solution.