From fa340a6cb5228b073287c45c586f1094b0b4deef Mon Sep 17 00:00:00 2001 From: Sam Rolfe Date: Sun, 11 Oct 2026 18:57:26 +1100 Subject: [PATCH] FR-2 confirmed: source address is X-Pm-Original-To (PurelyMail); forwarding verified --- AGENTS.md | 21 +++++++++++++-------- 1 file changed, 13 insertions(+), 8 deletions(-) diff --git a/AGENTS.md b/AGENTS.md index 17b1b0e..80da74f 100644 --- a/AGENTS.md +++ b/AGENTS.md @@ -47,7 +47,7 @@ Each item is testable. Numbering is stable; do not renumber. | ID | Requirement | |---|---| | FR-1 | Fetch new mail from Gmail with the Gmail API, on an n8n schedule. Store metadata and body. | -| FR-2 | Record which address the mail came through (`sam@audasmedia.com.au`, `hello@where-woof.com`, `hello@kontra.day`, or catch-all), read from the headers. | +| FR-2 | Record which address the mail came through. Read **`X-Pm-Original-To`** (added by PurelyMail). Fallbacks, in order: `To`, the PurelyMail `Received ... for
` clause, `Return-Path`. | | FR-3 | Classify each message with JEV: category, importance, suggested action, and a confidence. | | FR-14 | Edit the category list in the UI: add, rename, remove. JEV uses the current list. | | FR-4 | Apply user-written rules from the rules editor to override or refine the classification. | @@ -220,16 +220,14 @@ Resolved: 5. **Retention:** one month of message bodies. 6. **Mail access is IMAP + app password** — no console, no OAuth. Working on `.13` and `.51`. +7. **Source address is `X-Pm-Original-To`.** Confirmed on a real forwarded message + (`X-Pm-Original-To: Hello@where-woof.com`). PurelyMail adds this header, so + Gmail's overwritten `Delivered-To` does not matter. See FR-2. +8. **PurelyMail forwarding is live**, confirmed end to end. Remaining: -1. **No domain mail is arriving yet.** All 617 inbox messages are addressed to - `samuelrolfe@gmail.com`. None to `where-woof.com`, `audasmedia.com.au`, or - `kontra.day`. Confirm the PurelyMail forwarding, then send a test message. -2. **FR-2 header:** Gmail sets `Delivered-To` to the Gmail address. The original - domain address must come from the forwarding headers (`X-Original-To`, - `Delivered-To`, or the envelope). Confirm with a real forwarded sample. -3. **Send-as:** sending as a domain address needs Gmail "Send mail as" set up for +1. **Send-as:** sending as a domain address needs Gmail "Send mail as" set up for that address. ### Infrastructure notes (found during setup) @@ -239,3 +237,10 @@ Remaining: and SMTP. - Credentials live in `~/.config/environment.d/10-secrets.conf` on `.13` and `.51`, as `GMAIL_USER` and `GMAIL_APP_PASSWORD`. +- **Header fields seen on a real forwarded message** (id 619, from `favrolfe@gmail.com`): + ``` + X-Pm-Original-To: Hello@where-woof.com <- use this + To: Hello@where-woof.com + Return-Path: + Delivered-To: samuelrolfe@gmail.com <- Gmail overwrites this; ignore + ```