Mail Filters - Per-Address Handlers

PopIt3 routes emails based on the To: header, allowing specialized processing for different recipient addresses. Each filter has distinct logic, storage, and reporting.

Filter 1: john.js@critchley.biz (Job Analysis)

Handler Module

newparser_jobserve.py - Full AI-powered job analysis pipeline

Processing

Extracts job details from JobServe emails, calls OpenAI for CV matching and scoring (0-10), stores results with reasoning in ~/.jobserve.gdbm keyed by Message-ID. Handles alerts, suggestions, applications, and unclassified emails.

Output

Three report tables: Scored Jobs, Job Applications, Unclassified Emails. Deployed to https://www.critchley.biz/JobAnalysis, updated hourly.

Filter 2: john.dl@critchley.biz (Gym Bookings)

Handler Module

MyDavidLloydSchedule.py - Fitness class booking extraction

Processing

Parses David Lloyd booking confirmation and cancellation emails. Extracts class name, instructor, times, location, booking reference. Deduplicates by booking_reference, updates or inserts into ~/.dl.gdbm. Handles timezone normalization (UK BST/GMT).

Output

HTML timetable with weekly/monthly view. Deployed to https://www.critchley.biz/DavidLloyd/timetable.html, updated on each booking/cancellation.

Filter 3: envoy@critchley.biz (AI Agent Operations)

Handler Module

mailspool.py - Routes to Envoy AI Agent mailbox via WebDAV

Processing

Extract To header → route to envoy_mail_spool → store locally in ~/py/popit3/envoy/ (maildir structure) → upload to WebDAV /mail/envoy → return UIDL for POP3 deletion

Storage

Local: ~/py/popit3/envoy/ (new, cur, tmp)

Remote: /mail/envoy/ on webdav.critchley.biz

Deletion Policy

Messages deleted from POP3 after successful delivery to WebDAV (delete=True)

Filter 4: Spam Addresses (Hardcoded Blocklist)

Handler Module

process_emails.py - Inline spam filtering

Processing

Check To: header against hardcoded blocklist. If matches: return success (no storage), mark for POP3 deletion, optionally log.

Filter 5: Other Addresses (Mail Spooler)

Handler Module

mailspool.py - Generic mail router

Processing

Route any recipient address not matched above. Store in recipient-specific mailbox (GDBM or file-based), preserve raw MIME structure, enable search across archive.

Storage

Location: ~/.mail/spools or ~/.mail/recipients/

Retention: Indefinite (user-managed cleanup)

version2