Add INBOX candidate routing rules

Prompts used since the previous commit:
- Kijk nu in de INBOX en kijk of er nog meer kandidaten zijn om in de nieuwe structuur te plaatsen.
- Zuiderzee.net mag je zo laten. de oude werkcontexten mag je in aparte mappen zetten. Gmail mag je ook zo laten. KvK mag onder Administratie.KvK

Special observations:
- Added domain routes only; no mailbox-affecting script was run.
- verplaats_log.json remains modified from the user's run and was intentionally not staged.
This commit is contained in:
2026-07-04 18:39:59 +02:00
parent e6cd5f0268
commit 984382d030
2 changed files with 40 additions and 3 deletions
+18 -1
View File
@@ -51,6 +51,9 @@ Destination policy:
- Final destination folders are functional folders such as `Financieel`, `Werk`, `Diensten`, `Nieuwsbrieven`, `Bestellingen`, `Mobiliteit`, and `Technisch`.
- Final destination folders under `Archief` should not be created.
- `Technisch` and `Technisch.DMARC` are valid destination folders.
- `Administratie` is a valid destination root; KvK messages route to `Administratie.KvK`.
- Old work-context senders may be routed into separate folders under `Werk.Oude context.*`.
- `zuiderzee.net` and generic `gmail.com` messages should remain unmatched for now.
Sieve:
@@ -65,6 +68,19 @@ Shared modules:
- `imap_utils.py` centralizes IMAP modified UTF-7 folder encoding/decoding, quoted mailbox names, LIST parsing, and folder listing.
- `mail_routes.py` centralizes `PREFIX`, domain routes, invoice keywords, source-folder exclusions, already-sorted folders, invoice quarter routing, generated destination folders, and normalized mailing-list routing.
Current INBOX candidate domain routing additions:
- `mijnkantoorapp.nl` and `dijkman-ac.nl` route to `Financieel.Boekhouding.Dijkman`.
- `drenthe.nl`, `rdw.nl`, and `plasbossinade.nl` route to separate old-work-context folders under `Werk.Oude context`.
- `kvk.nl` routes to `Administratie.KvK`.
- `godaddy.com`, `cloud86.io`, and `cloud86.zendesk.com` route under `Diensten.Hosting`.
- `mail.anthropic.com`, `canva.com`, `account.canva.com`, `microsoft.com`, `market.envato.com`, `email.remarkable.com`, `nordaccount.com`, and `info.expressvpn.com` route under `Diensten`.
- `maandag.com` and `notifications.meetjamie.ai` route under `Werk.Opdrachten`.
- `tasks.clickup.com`, `gemeenteprojecten.talent-pool.com`, and `engage.istockphoto.com` route under `Afmelden`.
- `n26.com`, `update.bunq.com`, and `hello.bunq.com` route under `Financieel.Bank`.
- `notify.orcid.org` routes to `Nieuwsbrieven.Leren.ORCID`.
- `zuiderzee.net` and `gmail.com` are intentionally not routed.
Scripts using shared IMAP folder handling:
- `verplaats_bestaand.py`
@@ -176,6 +192,7 @@ Notable policy risks:
Latest local code verification:
- `python3 -m py_compile *.py`
- Explicit `route_from_subject()` checks for the latest INBOX candidate domains, including negative checks for `zuiderzee.net` and `gmail.com`.
- `git diff --check`
Earlier route/folder consistency check returned:
@@ -190,7 +207,7 @@ Latest live mailbox verification:
- Direct read-only IMAP count audit of both `hans` and `backup` accounts after the mirror.
- The user ran the previous dry-run sorter version against `backup@australius.nl`. It reached `INBOX.Archief.2022.verzonden` after completing `INBOX.Archief.2022.inkomend`, then the IMAP server closed the connection with `Server shutting down.`. The current code has reconnect/retry handling for that failure mode.
- The user started an actual sorter run on `backup@australius.nl`; it began moving messages from `INBOX` and then crashed on an unexpected IMAP `FETCH` response shape: `AttributeError: 'int' object has no attribute 'decode'`. The local `verplaats_log.json` contains processed `INBOX:<uid>` entries from that run and should be preserved if the user resumes sorting. The current code fixes this parser crash.
- No live mailbox script was run by Codex while adding the latest reconnect changes.
- A later read-only INBOX inspection of the `backup` account found 1,908 unmatched messages and identified additional candidate sender domains. No mailbox-affecting script was run by Codex.
## What To Do Next