EmDash's plugin architecture combined with Cloudflare's email sending capabilities makes it possible to build a fully automated email content digest system — curating top posts, personalizing recommendations, and sending beautifully formatted digests — without any external email marketing platform. ## The Email Content Challenge Email newsletters remain one of the highest-ROI content distribution channels, with an average return of $36 for every $1 spent (DMA, 2025). Yet most content teams struggle to maintain a consistent newsletter cadence for one simple reason: manual curation takes too long. The typical weekly newsletter workflow includes:

- Manually reviewing which posts published since the last send.

- Copying titles, URLs, and excerpts into an email template.

- Segmenting subscribers by interest or content type.

- Sending via Mailchimp, ConvertKit, or similar platforms.

- Tracking opens and clicks to inform future curation.

EmDash's plugin system can automate every step of this pipeline. The plugin runs as scheduled Workers that query D1 for recently-published content, score each post by engagement metrics, format the digest as HTML, and send it through Cloudflare's email routing or a transactional email API like SendGrid or Resend. ## Architecture Overview

| Component | Technology | Purpose |

|-----------|-----------|---------|

| Content Curation | SQL query on D1 | Fetch top posts since last digest |

| Personalization Engine | Plugin Workers | Match posts to subscriber segments |

| Template Renderer | Handlebars/HTML | Format digest with responsive email layout |

| Scheduler | Cron Triggers | Run digest generation on defined intervals |

| Delivery | Email API (SendGrid/Resend) | Send via transactional email routes |

| Analytics | D1 event store | Track opens, clicks, unsubscribes |

The entire system runs on EmDash's existing Cloudflare Workers infrastructure. The plugin registers a cron trigger for each configured digest schedule, and each run produces a fully-rendered HTML email sent to every active subscriber. ## Step 1: Content Curation Query

The first step is a D1 query that selects the top-performing content published since the last digest was sent. The plugin maintains a last_digest_at timestamp per subscriber list:

```sql

SELECT

p.id,

p.title,

p.slug,

p.excerpt,

p.category,

p.published_at,

COALESCE(SUM(e.score), 0) AS engagement_score

FROM posts p

LEFT JOIN engagement_events e ON e.post_slug = p.slug

AND e.created_at > ? -- last_digest_at

WHERE p.published_at > ?

AND p.status = 'published'

GROUP BY p.id

ORDER BY engagement_score DESC, p.published_at DESC

LIMIT 10;

```

This query returns the most engaged-with posts since the last digest. The engagement_score is computed by the lead scoring plugin (or a simpler heuristic: views + 2×shares + 3×downloads), giving you a natural content curation signal without manual effort. ## Step 2: Content Digest Categories

Rather than sending every subscriber the same email, the plugin segments digests by content category. A subscriber who consistently reads Architecture posts gets a different digest than one who reads Tutorials. Segment membership is determined by:

- **Explicit preference** — subscriber selects categories during signup.

- **Implicit behavior** — plugin tracks which categories each subscriber reads most.

- **Combined score** — if implicit data is strong enough, it overrides explicit preference.

Each segment generates its own digest email with a personalized subject line and curated content. The segmentation rules live in D1 as a simple table:

```json

{

"subscriber_id": "abc123",

"categories": ["Architecture", "Marketing Automation"],

"frequency": "weekly",

"last_sent_at": "2026-05-18T06:00:00Z",

"implicit_bias": {

"Architecture": 0.8,

"Tutorials": 0.4,

"Product Updates": 0.2

}

}

```

Step 3: HTML Template Rendering

The digest template is a responsive HTML email built with inline CSS (required by most email clients). The plugin uses Handlebars-style template injection with EmDash's built-in template engine:

```html

<div style="max-width:600px; margin:0 auto; font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;">

<div style="background:#f8fafc; padding:24px; border-radius:8px;">

<h1 style="font-size:20px; color:#0f172a; margin:0 0 4px;">

Your {{category}} Digest

</h1>

<p style="color:#64748b; font-size:14px; margin:0 0 20px;">

{{date}} — {{post_count}} new posts

</p>

{{#each posts}}

<div style="margin-bottom:20px; padding-bottom:16px; border-bottom:1px solid #e2e8f0;">

<a href="{{url}}" style="font-size:16px; font-weight:600; color:#2563eb; text-decoration:none;">

{{title}}

</a>

<p style="font-size:14px; color:#475569; margin:6px 0 0;">{{excerpt}}</p>

<div style="font-size:12px; color:#94a3b8; margin-top:6px;">

{{category}} · {{read_time}} min read

</div>

</div>

{{/each}}

<div style="text-align:center; margin-top:24px;">

<a href="{{unsubscribe_url}}" style="font-size:12px; color:#94a3b8;">

Unsubscribe from {{category}} digests

</a>

</div>

</div>

</div>

```

The template is stored as a plugin asset and rendered at digest-generation time. Open tracking is handled by a 1x1 transparent pixel served through an EmDash Worker endpoint. ## Step 4: Scheduled Execution via Cron Triggers

The plugin registers a cron trigger in wrangler.toml (or the EmDash plugin manifest) that fires at the configured interval. The schedule is configurable per subscriber list:

| Frequency | Cron Expression | Use Case |

|-----------|----------------|----------|

| Daily | `0 6 * * *` | Breaking news, product updates |

| Weekly | `0 8 * * 1` | Standard content digest |

| Biweekly | `0 9 1,15 * *` | Deep-dive technical content |

| Monthly | `0 10 1 * *` | Roundups, case study compilations |

Each cron run invokes the plugin's handleDigest() entrypoint, which iterates over active subscriber segments, generates personalized HTML, and calls the email API for each batch. ## Step 5: Delivery and Analytics Integration

Digests are sent through a transactional email provider integrated as an EmDash plugin dependency. The plugin stores delivery metadata in D1:

```sql

CREATE TABLE digest_events (

id INTEGER PRIMARY KEY AUTOINCREMENT,

subscriber_id TEXT NOT NULL,

digest_id TEXT NOT NULL,

post_slug TEXT,

event_type TEXT NOT NULL, -- 'sent', 'opened', 'clicked', 'unsubscribed'

timestamp INTEGER NOT NULL,

FOREIGN KEY (subscriber_id) REFERENCES subscribers(id)

);

CREATE INDEX idx_digest_events_subscriber ON digest_events(subscriber_id);

CREATE INDEX idx_digest_events_digest ON digest_events(digest_id);

```

Every opened email and clicked link generates an event row, which feeds back into the content curation algorithm. Posts with high click-through rates in digests get boosted engagement scores for future curation rounds, creating a self-reinforcing content quality loop. ## Practical Implementation Tips

- **Batch sends in chunks of 50** to avoid hitting transactional email API rate limits. Use Promise.all() with concurrency control.

- **Pre-render email HTML** at digest generation time rather than per-subscriber to minimize D1 read volume. Personalization is limited to the category-specific content block.

- **Handle bounced emails gracefully** by maintaining a bounce_count column in the subscribers table. After 3 consecutive bounces, mark the subscriber as inactive and stop sending.

- **Include a one-click unsubscribe link** with a signed token (HMAC-SHA256 with a secret stored in Workers secrets) so unsubscribes require no database writes at click time.

- **A/B test digest subject lines** by sending two variants to small sample groups and promoting the winner to the full list after 4 hours. The plugin stores subject line variants in D1 and tracks open rates per variant. ## Measuring Success

Track these metrics to gauge your digest engine's performance:

- **Open rate** — target 30-40% for curated digests (industry average is 21% for marketing emails).

- **Click-through rate** — target 3-5% for content digests.

- **Unsubscribe rate** — keep below 0.5% per send. If it spikes, your frequency is too high or content isn't relevant.

- **Digest-to-site traffic** — measure how many digest clicks convert to secondary page views on your site.

- **Subscriber growth rate** — net new subscribers per week should exceed unsubscribes for a healthy list.

Building an automated email content digest with EmDash plugins eliminates the most time-consuming part of newsletter production — manual curation — while delivering personalized, category-specific content that drives higher engagement than generic broadcasts. It runs entirely on your Cloudflare infrastructure with no third-party email platform costs beyond transactional sending fees.