Reduce mailcat to reporting and reorder tools

The prompts used to arrive at this change since the previous commit

User said the real hans mailbox has been reordered, Roundcube filters are uploaded, the sorter and web rule interface are no longer needed, then asked to keep logs and perform the cleanup while retaining unsubscribe capability.

Any special observations that may be relevant for version management for this version. Be brief.

Kept daily report, Sieve policy, folder/reorder scripts, unsubscribe script/data, and log/state files. Removed live sorter, web UI, deploy helpers, old analysis artifacts, backup mirror, and obsolete tests. Verification passed; verplaats_log.json, plan.md, and roundcube.txt remain unstaged/local.
This commit is contained in:
2026-07-05 13:49:53 +02:00
parent db209ac246
commit 12a82f570a
30 changed files with 89 additions and 34040 deletions
+10 -3
View File
@@ -15,7 +15,6 @@ import imaplib
import email
import email.header
import email.utils
import json
import sys
import ssl
import smtplib
@@ -24,12 +23,10 @@ import html as html_lib
import urllib.parse
import config
from datetime import date, timedelta, datetime
from pathlib import Path
from collections import defaultdict
from email.mime.multipart import MIMEMultipart
from email.mime.text import MIMEText
from imap_utils import list_folders, quote_mailbox
from mail_imap_ops import fetch_body
# Mappen die NIET in het overzicht komen (systeem + inbox zelf)
UITSLUITINGEN = {
@@ -111,6 +108,16 @@ def apple_mail_url(message_id: str) -> str:
return "message://" + urllib.parse.quote(clean, safe="")
def fetch_body(data) -> bytes | None:
"""Return the first bytes payload from an IMAP FETCH response."""
if not data:
return None
for item in data:
if isinstance(item, tuple) and len(item) >= 2 and isinstance(item[1], bytes):
return item[1]
return None
# ── IMAP ophalen ──────────────────────────────────────────────────────────────
def haal_berichten_op(mail: imaplib.IMAP4_SSL, zoekdatum: date) -> dict[str, list[dict]]: