Work  /  Case study

Tooling · Cloudflare Workers · Node.js

Mail Merge & Tracker

A small business needed to send one personal email to every customer and see who opened it and who clicked, without paying for a monthly email platform. I built a mail-merge script and a tracking service on Cloudflare's edge network to do it.

Client
Clothing retailer
My role
Solo: design & build
Built
October 2026
Hosting cost
Cloudflare free tier
Try the demo dashboard Download the kit How it works

The problem

Personal emails, real numbers, no subscription

What the owner wanted

  • Emails that greet each customer by name, sent from their own address
  • To know which campaign got opened and which links got clicked
  • Something a non-technical team member could run alone

Constraints

  • No monthly fee for a full marketing platform
  • Customer email addresses must not sit on someone else's server
  • Tracked links must only ever go to the store's own website

How it works

Two pieces: a sender and a tracker

The sender runs on the owner's computer. The tracker is a tiny Cloudflare Worker that counts events. The two share only anonymous codes, never addresses.

Sending

Contacts + templatecontacts.csv and an HTML email with {{name}} placeholders
Dry runRenders every email and writes preview.html, sending nothing
Personalise + tagEach person gets an HMAC-SHA256 code, a tracking pixel and wrapped links
Send over SMTPNodemailer with a pause between sends; failures go to failed.txt

Tracking

Email openedThe 1×1 pixel loads from /o
Link clicked/c checks the target against an allow-list, then redirects
Counted in KVPer campaign and per anonymous code, with a timestamp
DashboardKey-protected; matches codes to names in the browser only

The sender in action

Sample contacts. The first email is also saved to preview.html.

Decisions I'm proud of

  • Privacy by design. The tracker only sees short codes made with HMAC-SHA256 and a secret salt that stays on the sender's computer. Matching codes to people happens in the dashboard viewer's browser from a local file, which is never uploaded.
  • No open redirect. Click links only redirect to hosts on an allow-list, so spammers can't borrow the tracker.
  • Safe by default. A dry run and a preview file come before every real send.
  • Hand-off ready. Shipped as a downloadable kit with plain-English setup steps for Mac and Windows.

Interactive demo

Play with the dashboard

This is a copy of the real dashboard running on made-up sample data in your browser. Switch campaigns, simulate opens and clicks, and try the link builder.

mail-tracker.workers.dev/dashboard
Demo · sample data

Mail Tracker

Updated just now
0Emails sent
0Opens
0Clicks
0%Click rate (of opens)

All campaigns

OpensClicks

People in this campaign

PersonOpensClicksLast activity

Simulate activity

Pretend a random person in this campaign opens the email or clicks a link.

Link builder

Allowed hosts in this demo: shop.example.com. Try another site to see it refused.

The real dashboard is private and protected by a secret key, so this demo never touches it.

Free download

Get the kit and use it yourself

The whole project, ready to run: the mail-merge sender, double-click launchers and the optional tracker. Pick the version for your computer. Each one is about 15 KB, free, MIT licensed.

  1. Install Node.js

    Download the LTS version from nodejs.org and install it with the default options. You only do this once.

  2. Unzip the kit

    Right-click MailMerge-Kit-Windows.zip > Extract All. It won't run from inside the zip.

  3. Double-click 1 - Setup.bat

    It installs what the kit needs and opens your settings in Notepad.

    If you see "Windows protected your PC", click More info > Run anyway. The script only works inside the kit folder.

  4. Fill in your settings and save

    See the settings table below. Change them later with Edit settings.bat.

  5. Add your people and your message

    Open sender\contacts.csv in Excel or Notepad (columns: name,email,business) and edit sender\template.html.

  6. Preview, then send

    Double-click 2 - Preview.bat: nothing is sent, and the first email opens in your browser. When it looks right, double-click 3 - Send.bat and type SEND.

Your settings

Optional: turn on open & click tracking

Tracking is off until you deploy your own tracker, so your data never goes to anyone else. You need a free Cloudflare account. Open a terminal (Windows: Command Prompt, Mac: Terminal) in the kit's tracker folder and run:

# sign in to Cloudflare npx wrangler login # create storage, then paste the printed id into wrangler.toml npx wrangler kv namespace create TRACK # set ALLOWED_HOSTS in wrangler.toml to your own website, then pick a dashboard password npx wrangler secret put STATS_KEY # publish it: this prints your tracker address npx wrangler deploy

Then set TRACKER_URL and TRACKED_HOSTS in your settings. Your dashboard is at https://mail-tracker.YOUR-NAME.workers.dev/dashboard?key=YOUR_PASSWORD.

Only email people who agreed to hear from you, and keep the unsubscribe line in the template. A normal Gmail account can send about 500 emails a day. Never share your settings file: it holds your email password.

What I learned

Honest numbers beat pretty numbers

Opens are a hint, clicks are evidence

Apple Mail and Gmail pre-load or proxy images, so open counts can be inflated or hidden. I made the dashboard lead with click rate and said so plainly in the kit's guide.

Design for the person who runs it

The hardest part wasn't code but making setup work for someone who had never opened a terminal: drag-the-folder instructions, an App Password guide and clear error files.

Built with

Need a tool like this?

I build small, focused tools that save businesses money, from email and tracking to stores and dashboards.