BorisovAI
All posts
New Featureemail-senderClaude Code

From Spam to Legitimacy: Rebuilding Email Systems Right

From Spam to Legitimacy: Rebuilding Email Systems Right

When Legal Requirements Meet Engineering Reality: Redesigning an Email Campaign System

The email-sender project started with a simple pitch: build a system to send bulk campaigns to companies. But as the developer dove deeper, the reality of spam filters, compliance laws, and genuine personalization became starkly clear. This wasn’t going to be a quick template-and-send solution.

The initial approach raised red flags immediately. The plan mentioned techniques that sounded like deliverability optimization—randomizing content, rotating domains, varying email formats to “avoid spam filters.” But upon closer inspection, these were borderline evasion tactics. Even with formal consent from recipients, circumventing email provider protections crossed an ethical line. That’s when the developer made a critical decision: pivot toward legitimacy.

The first thing done was dismantling the spray-and-pray architecture. Instead of building a custom sender from scratch, the plan shifted to integrating established Email Service Providers—SendGrid, Mailgun, and Amazon SES. These platforms already handle SPF, DKIM, and DMARC authentication, maintain sender reputation, and enforce opt-in requirements. Why reinvent a compliance nightmare?

The new architecture centered on consent management. A PostgreSQL database would track double opt-in subscriptions, unsubscribe events, and engagement metrics. The system would use Node.js backend services to manage a queue of legitimate campaigns, with Redis handling rate limiting and delivery scheduling. Instead of mutation techniques, personalization would come from actual data: company information, previous interactions, and AI-generated content tailored to genuine business interests.

Unexpectedly, the most complex piece wasn’t the personalization engine—it was the email templating syntax itself. The initial plan used Liquid template syntax (think Shopify’s templating), but the production stack demanded Handlebars. A simple oversight: {{value | default: "x"}} doesn’t work in Handlebars. The correct syntax requires conditional blocks: {{#if value}}{{value}}{{else}}x{{/if}}. This small detail cascaded through 14 different email templates.

The database schema expanded to 8 core tables: consent_logs for tracking opt-ins, verification_attempts for email validation, warmup_logs to monitor sender reputation, ai_generations for personalization history, and engagement_scoring for analytics. Every table told a story of compliance-first design.

Here’s something fascinating about DMARC (Domain-based Message Authentication, Reporting & Conformance): it’s not a spam filter at all. It’s a reporting mechanism that tells domain owners when someone is impersonating their email. Major inbox providers like Gmail use DMARC reports to block entire domains, not individual emails. This is why building sender reputation matters far more than obfuscating content.

The project taught a hard lesson: sometimes the right engineering decision isn’t the shortest path. B2B email marketing in 2025–2026 rewards systems that respect both user intent and technical standards. The developer’s refusal to compromise turned a compliance problem into a technical one worth solving properly.

😄 Your DMARC alignment will thank you on Monday morning.

Metadata

Session ID:
grouped_email-sender_20260207_1858
Dev Joke
Have a great weekend! I hope your code behaves the same on Monday as it did on Friday.

Rate this content

0/1000