MailCull
Self-hosted Gmail triage. A local Ollama model classifies senders, then you unsubscribe or mute them in bulk.
- Year
- 2026
- Status
- In progress
- Stack
-
- Python
- FastAPI
- React
- Ollama
- Gmail API
- Links
What it is
MailCull is a single-user tool for technical people who want to reclaim their inbox without handing email data to a third party. It reads the headers of your Gmail messages. For senders without an unsubscribe header, it also reads the newest message’s body, locally and in memory only, to find an unsubscribe link.
Classification runs through a local Ollama model, and a dense batch-triage screen lets you decide what happens to each sender. MailCull then carries it out. It runs on your own machine and is open source.
Why I built it
Existing unsubscribe tools work by reading your email on their servers and sending unsubscribe requests on your behalf. MailCull does neither. Every read goes through the Gmail API directly to your inbox. Every classification runs in a local LLM. The OAuth token never leaves the machine running MailCull.
Technical notes
- Unsubscribing follows a fallback chain: an RFC 8058 one-click request first, then a mailto (parsed per RFC 6068) sent through the Gmail API, then a headless Chromium browser that clicks the opt-out, and finally a manual link. Later scans flag senders that are still sending after you unsubscribed.
- It reads metadata only. A message body is fetched only for the newest message without an unsubscribe header, then parsed in memory and discarded. Fetches run in Gmail batches of 100.
- The model’s output is constrained by a JSON schema. If Ollama is unreachable, a header-rules heuristic takes over, so the pipeline never blocks.
- Every action needs explicit confirmation at the API, and the model’s suggestion is stored separately from your decision.
- The OAuth token is Fernet-encrypted at rest with 0600 permissions. A mail-source adapter leaves room for IMAP later.