A Thunderbird/Betterbird MailExtension that classifies and tags email using a local Ollama LLM. Define tags in plain English; the extension matches incoming mail in a single LLM call, applies Thunderbird tags, runs optional rules (move, archive, trash), and marks messages as processed.
Privacy-first: email content is sent only to your local Ollama instance (localhost). No cloud API required.
- One LLM call per email — all active tag definitions are evaluated together for efficiency
- Natural-language tags — describe when a tag should apply; optional keywords for small models
- Automatic processing — classify new mail as it arrives (
onNewMailReceived) - Manual runs — context menu, folder batch, or all-unprocessed across accounts
- Action rules — move, archive, or trash when tag conditions match (AND/OR)
- Priority & stop processing — control which tags win when multiple match
- Processed marker — skip already-classified messages (configurable tag)
- Built-in tester — paste sample email content and inspect JSON results in Options
- Thunderbird or Betterbird 128+
- Ollama running locally with a pulled model (default:
llama3.1:8b)
git clone https://github.com/Mecallie/thunderbird-ai-tagger.git
cd thunderbird-ai-tagger
npm install
npm run buildLoad the built extension in Thunderbird:
- Add-ons and Themes → gear icon → Debug Add-ons
- Load Temporary Add-on → select
manifest.json(or install the zip fromweb-ext-artifacts/)
Download ai_tagger_for_thunderbird-0.1.20.zip from Releases, then load it as a temporary add-on (or install via your preferred method).
- Open AI Tagger settings (toolbar button or Add-ons → Preferences).
- Confirm Ollama URL and model, then click Test Ollama Connection.
- On the Tags tab, add tags with descriptions and click Save All Tags.
- Enable automatic processing on the LLM & Settings tab, or use Test & Manual Run to try a sample email.
npm run lint # web-ext lint
npm run build # package to web-ext-artifacts/
npm run start # run with web-ext (Thunderbird target)Background script logs appear in about:debugging → This Thunderbird → AI Tagger → Inspect. The options page has its own console.
| File | Role |
|---|---|
background.js |
New-mail listener, classification orchestration, bulk runs |
options.html / options.js |
Settings UI (tags, rules, Ollama config, tester) |
utils/ollama.js |
Prompt builder, Ollama /api/chat, JSON parsing |
utils/email.js |
Extract plain-text body from messages |
utils/tagManager.js |
Sync tags with Thunderbird's tag system |
utils/actionEngine.js |
Post-classification rules (move, archive, trash) |
utils/folders.js |
Folder picker for action rules |
utils/storage.js |
browser.storage.local helpers |
MIT — see LICENSE if present, or MIT as stated in package.json.
thunderbird · betterbird · thunderbird-addon · mail-extension · webextension · ollama · llm · email-classification · ai · local-ai · email-automation