Case study · Personal project, not work · 2026

Mail Auto-Sort

A problem in my own personal inbox, solved on my own time. A scheduled sorter for Apple Mail that files mail after I've read it, logs every move, and gets me off marketing lists I never signed up for.

Problem

My personal inbox ran on about 50 mail rules. Apple's rules, even on the latest macOS, couldn't do what I wanted. They act the moment mail arrives, so important emails went into folders I never saw, and they can't unsubscribe or keep a record.

What I did

Everything but the code. I wrote the requirements, the rules and the safety limits, and I review the results daily.

Built with

AppleScript on my Mac, a scheduled run, a ledger file, and a daily AI-written report I answer with one tap. Code written with an AI coding assistant.

Outcome

1,495 emails filed

In its first 10 days, across 18 runs.

21

folders it files into

10

automatic unsubscribes

0

emails ever permanently deleted

Key decisions

Sort after I've read it

Why: Everything lands in the inbox first. Only mail I've read, that isn't flagged and is at least two days old, gets filed. Nothing is hidden before I see it.

Trade-off: The inbox is busier for a couple of days.

Match on the address mail was sent to

Why: I give every company its own hidden email address, so the address a message was sent to identifies the sender better than display names, which change and collide.

Trade-off: New senders wait for a decision. After about five emails from one company, it asks me where they should go.

A ledger for every move

Why: Automation is only trustworthy if you can audit it. Every move, unsubscribe and decision is written to a ledger, and a daily report summarizes it for review.

Trade-off: A few minutes of review a day, shrinking as the rules settle.

I removed a feature after it made a mistake

Why: An early "block future marketing" feature sent a real account statement to the trash. I replaced it with a counter that flags companies I keep unsubscribing from, so I decide what happens next.

Trade-off: More decisions for me. Zero silent losses.

Found the real cause, then built around it

One-click unsubscribe almost never worked for me. Comparing the signed headers senders sent with what my Mac received showed why: the private-relay service I use strips the unsubscribe header. So the app opens the unsubscribe page instead, only on a domain it can tie to the sender or a known email service, clicks only unsubscribe and confirm buttons, saves proof, and stops at any CAPTCHA or login and leaves the page open for me.

Safe by default

It started in dry-run mode, listing what it would do without moving anything, until I switched it live. Anything it removes goes to Trash, where it stays recoverable for about 30 days. Nothing is ever permanently deleted. If a run fails twice, I get a distinct alert, and if my Mac was off at the scheduled time, it catches up.

What I'd do next

  • Fully hands-off: rules settled enough that the daily report is just a summary with nothing to answer.
  • Learn from patterns in failed unsubscribes and suggest the fix, not just the failure.