# Boys' Email Daily Digest Monitor children's email inboxes, log new messages, track sender frequency, and send daily digest summaries to each child's mom. ## Architecture Single Python script (`/root/.hermes/scripts/boys-mail-monitor.py`) with three commands: | Command | Schedule | Description | |---|---|---| | `collect` | Every 60m | Polls child inboxes for UNSEEN, logs to JSON, tracks senders | | `summary` | Daily at 7 PM ET | Builds + sends daily digest HTML emails | | `test-summary` | On-demand | Sends test digest to shonuff inbox for verification | ## Data files | File | Purpose | |---|---| | `boys-mail.json` | Rolling log of all collected emails (30-day retention by timestamp) | | `boys-senders.json` | Sender frequency database (count, first/last seen, flagged status) | ## Children and Recipients | Child | Mom | Mom Email | BCC | Webmail | |-------|-----|-----------|-----|---------| | Garrison | Tina Brown | tinamichelle1008@gmail.com | g@germainebrown.com | webmail.iamgmb.com | | Greyson | Kate Eubank | katherineeubank@gmail.com | g@germainebrown.com | webmail.iamgmb.com | ## IMAP polling details - **Accounts:** Defined in `BOYS_ACCOUNTS` dict — each child has their own IMAP credentials on `heracles.mxrouting.net:993` - **Fetch:** Uses `BODY.PEEK[]` to avoid marking messages as `\Seen` — boys' normal mail client still sees them as unread - **Fallback:** If `BODY.PEEK[]` fails, falls back to `(RFC822)` which does mark as seen - **Dedup:** Relies on IMAP UNSEEN state — a message is only returned once until someone marks it UNSEEN again ## Sender frequency tracking - Every unique `from_email` gets a cumulative count, first/last seen timestamps, and a child association - **High-volume alert:** Senders with `count >= HIGH_VOLUME_THRESHOLD` (default 3) get flagged in the database and highlighted amber in the summary - **Name enrichment:** If a later email provides a display name for a previously-email-only sender, the name is updated ## Daily summary email ### HTML email structure - **Title bar:** Red `border-bottom: 2px solid #dc2626` divider under child's name + date - **Green "No new emails"** pill when inbox was quiet (`background: #f0fdf4, border: #bbf7d0`) - **Email table** when there were new emails: From / Subject / Time columns - **Top senders table** showing who's been emailing the most, with amber highlighting for high-volume senders - **Signature:** Sho'Nuff full signature — red divider, circular SB badge, random title, random closing - **Footer:** Information about frequency adjustments, phone login credentials (available on request), webmail link, and Sho'Nuff signature with unsubscribe assistance offer ### MIME structure Both `text/plain` and `text/html` alternatives via `MIMEMultipart("alternative")`. Plain text has table-formatted content for email clients that don't render HTML. ## Sho'Nuff signature (applies to ALL emails from this system) ```html
Sho'Nuff Brown
{random_title} · shonuff@germainebrown.com
_{random_closing}_