Back to News & Insights
Artificial Intelligence September 30, 2026 · 5 min read

How I Built an Autonomous B2B Lead Enrichment & SMTP Verification Engine in Python for $0.003/Lead

Stop burning sender reputation. Build an async Python engine that verifies SMTP handshakes, scrapes live web signals, and outputs 1:1 icebre

How I Built an Autonomous B2B Lead Enrichment & SMTP Verification Engine in Python for $0.003/Lead

How I Built an Autonomous B2B Lead Enrichment & SMTP Verification Engine in Python for $0.003/Lead

If you have ever scaled outbound campaigns beyond a few hundred contacts a week, you know the exact failure mode: commercial lead databases are stale, bulk email validators miss catch-all domains, and generic "Hey {{FirstName}}, loved your profile" templates land straight in the spam folder.

Most B2B automation tools force you into an expensive stack ($200+/month for enrichment, $90/month for verification, $150/month for sending tools) that still leaves you with a 4% bounce rate and burned sending domains.

In this tutorial, we will build a production-grade, asynchronous engine using Python, asyncio, aiohttp, DNS/SMTP verification, and an LLM dual-pass pipeline that: Validates MX records and simulates zero-payload SMTP handshakes to kill hard bounces. Asynchronously scrapes the target prospect's homepage and /about or /blog pages. Passes extracted signals through a strict JSON-schema LLM prompt to craft context-aware first lines. Runs up to 500 leads/hour safely on local hardware or a cheap VPS. The Bottleneck: Why Commercial Solutions Fail

Commercial enrichment APIs (like Apollo, ZoomInfo, or Clearbit) suffer from two structural problems: Data Staleness & Cache Lag: People change jobs, companies change positioning, and domains rotate. When you blast an unverified list, 3-8% of emails hard bounce. If your bounce rate exceeds 2%, Google Workspace and Microsoft 365 systematically degrade your domain reputation. Template-Fatigue Spam Filters: Modern mail filters (e.g., Proofpoint, Google Postmaster) analyze lexical diversity across outbound campaigns. Sending 5,000 variations of the exact same sentence with only swapped tokens triggers heuristic spam filtering.

To solve this, we need real-time verification at execution time and live website extraction rather than database lookups. The Architecture

The pipeline operates across four decoupled asynchronous stages: Stage 1 (SMTP Simulation): Resolves MX records via aiodns, establishes a socket connection to the mail server on port 25, sends HELO and MAIL FROM, followed by RCPT TO, and terminates the socket prior to issuing DATA. Stage 2 & 3 (Live Signal Capture): Non-blocking HTTP extraction to capture the company's true value proposition and fresh announcements. Stage 4 (Structured LLM Engine): Uses OpenAI or a local Ollama endpoint (mistral or llama3) running with responseformat={"type": "jsonobject"}. The Code & Logic

We avoid triggering spam filters by never sending the actual message body. We only evaluate the SMTP response code after RCPT TO:

Next, extract text from the prospect's company URL. We only retain high-signal text elements, discarding scripts, styles, navigations, and footers:

Now we take the extracted plain text and run it through an LLM to generate a bespoke cold outreach opening line. Notice the anti-fluff instructions: Deployment, Rate Limiting & Performance

When running this at scale, mail servers will drop your IP if you open 50 connections at once to the same host (e.g., Google or Outlook).

Benchmark Numbers: Throughput: ~500 leads / hour on a $5/month VPS. Cost per Lead: ~$0.003 (dominated by gpt-4o-mini tokens; $0.000 if using a local Ollama instance like mistral:7b-instruct). Bounce Rate: Dropped to < 0.8% in testing across 2,400 corporate domains. Conclusion & Ready-to-Use Workflow

You now have the blueprint to run high-volume, low-cost outbound pipelines without relying on brittle third-party providers. By combining direct async DNS/SMTP checks with targeted extraction, your domain reputation stays pristine while your cold email response rates climb.

You can implement this architecture by copying the snippets above into your custom backend, or grab the fully configured, production-tested engine complete with test fixtures, automated CRM push webhooks, and n8n integration schemas: Instant Access on Whop: Cold Outreach Personalization & Verification Engine Direct Download on Gumroad: Get the Engine on Gumroad (Use coupon code EARLYBIRD at checkout for 20% off).

Drop a comment below if you have questions about handling MX catch-all responses or fine-tuning local Ollama models for high-concurrency parsing!

Want to discuss this further?

Book a free strategy call with our team to see how these insights apply to your specific business goals.

Book a consultation