Connection
Folders
iPick the folders to scan. Gmail uses special names like [Gmail]/All Mail, [Gmail]/Trash (may be localized). Connect first to load the list.
Not connected - folders will appear here. Defaults to INBOX.
Add to scan just includes a folder in the list above (creates nothing). Create on server actually creates a new folder - a label on Gmail - on your mailbox (e.g. to use as a move destination).
⚠️ Every action - Run, List senders, Empty folder, Move - applies to the selected folders above. On a folder row, 🗑 deletes it on the server (system folders like Trash/Sent are protected and have no 🗑), while × only removes it from this list.
What to match
•
spam@example.com - exact sender address•
*@newsletter.com - that domain exactly, never subdomains•
annoying.com - that domain, plus subdomains if “Include subdomains” is on•
mail.annoying.com - that specific subdomain• lines starting with
# are commentsIn "full" mode,
*@paypal.com = paypal.com without Include-subdomains. The point: with Include-subdomains on, *@paypal.com stays exact while bare domains (e.g. newsletter.com) also catch their subdomains - so you can mix per-entry. ("search" mode is always a substring match.)
one entry per line · reuse across runs
Rules match server-side (substring), so a domain also matches its subdomains and partials - and *@ is not special here. For an exact domain with no subdomains, use a Target list with *@domain.com and scan mode "full".
Options
pip install "imap-cleanup-tool[ai]"
then restart the web UI.
Advanced: scoring weights (calibrated)
Disabled because you’re using a Rule: rule matching is always a fast server-side SEARCH (subdomains already included). Scan mode applies only to Target lists.
With “Gmail: move to Trash” this has no effect - messages just go to Trash. To delete for good, then select [Gmail]/Trash and use Empty folder.
Pick an existing folder, or choose ➕ Create new… to make one (a label on Gmail). Tip: leave the Target list / Rule empty to move every message in the selected folders.
⚠️ Will delete all messages in the selected folders (the ones ticked under Folders), not just matches.
Deletes / moves matching messages in the selected folders. With dry-run on, “Run” only previews.
Shows the senders in the selected folders ranked by how many emails each sent - use it to decide what to target.
Downloads the last “List senders” result to your browser’s download folder. Edit the file name if you like; with “ask where to save” enabled, your browser also lets you choose the folder.
Log
New scheduled job
The job connects with a saved profile; folders, match and options come from the Cleanup tab. It runs the CLI on a schedule - different jobs can use different profiles (different accounts).
pip install "imap-cleanup-tool[ai]" then restart the web UI.
When off, this job runs a normal cleanup using the match (targets/rule) and options you set in the Cleanup tab (folders, move/delete, gmail-trash, expunge…). Turn it on for an AI Cleanup job instead.
Saved jobs
Runs via the system scheduler (Task Scheduler / cron) - even when this app is closed.pip install "imap-cleanup-tool[ai]" then restart the web UI.
Add / edit a model
The model used by AI Cleanup. Local-first & BYOA (Bring Your Own API key): run a free local model (Ollama) so nothing leaves your machine, or bring your own key for any cloud model (OpenAI, OpenRouter, ...). Powered by litellm, so both use the same form. The key is stored in a local SQLite DB and can be encrypted, and is never committed. ⚠️ Remote models send only sender subjects + stats (never the message body) to that provider - for full privacy prefer a local model.
Configured models
No models yet.
Add / edit an SMTP profile
Outgoing mail server used to send notification emails. The password is stored locally (SQLite) and can be encrypted (an encrypted profile can't run in scheduled jobs). Supports any provider - Gmail, Amazon SES, Outlook, SendGrid, etc.
- ○ at least 8 characters
- ○ a lowercase letter
- ○ an uppercase letter
- ○ a number
- ○ a special character
- ○ both passphrases match
This passphrase is never stored - you'll need it to use the profile (encrypted profiles can't run scheduled jobs).
Notifications
Get an email when a cleanup finishes. One profile is active. By default emails are sent for scheduled jobs; you can also enable them for interactive runs. For Gmail accounts the email reminds you to empty the Trash.
Saved SMTP profiles
No profiles yet.
Spam addresses
Senders flagged by AI Cleanup (report or run) for the connected mailbox, with their heuristic spam score and the LLM verdict. Click a column header to sort the whole list. Select rows to remove them from the list, or flag senders as spam - a popup lets you either move one message to the Junk/Spam folder and delete the rest (like Run), or just move all their mail to Spam. It scans the folders selected in the Cleanup tab (just like a run); the popup shows which ones. Moving mail to Spam is the standard "report spam" signal that trains the server to route their future mail to spam. Each connection has its own list. You can also add a sender manually below, and load matching addresses into a Target list from the Cleanup tab.
SenderiThe sender's email address (the local-part + domain extracted from the From header). Click to sort. |
ScoreiHeuristic spam score, 0-10. A weighted blend of the signals below, normalized to 10: List-Unsubscribe present, unread ratio, send frequency, Precedence: bulk, and a bulk-looking sender name (noreply@, newsletter@…). Higher = more spam-like. Click to sort. |
MsgsiTotal messages seen from this sender in the scanned folder(s). Click to sort. | UnreadiUnread ratio = messages without the \Seen flag ÷ total. A high ratio means you rarely open their mail. Click to sort. |
Msgs/weekiSend frequency: messages per week, estimated from the span between the oldest and newest Date headers. Frequent senders score higher. Click to sort. |
SignalsiBoolean flags that feed the score: unsub = has a List-Unsubscribe header; bulk = Precedence: bulk; pattern = a bulk-looking sender name (noreply@, newsletter@, no-reply@…). Sorts by how many signals are set. |
LLM verdictiThe model's judgement (only if AI Cleanup ran with a model): delete or keep, with its reason and confidence. Sorts by verdict then confidence. Empty if heuristic-only. | Unsubiauto = can be unsubscribed automatically (mailto via SMTP, or one-click link). A link ↗ = opens a confirmation page to finish by hand. Blank = no List-Unsubscribe (run a fresh AI report to detect it). Use the Unsubscribe button on the selected rows. |
|
|---|---|---|---|---|---|---|---|---|
| No spam addresses yet - run an AI Cleanup report first. | ||||||||