1.7 KiB
1.7 KiB
DRE Mail IMAP Poller
A lightweight, no-dependency IMAP poller that checks DRE mailboxes and serves as a unified inbox JSON endpoint for the DRE portal.
Script Location
/root/.hermes/scripts/dre-mail-poller.py
How It Works
- Polls both
dre@debtrecoveryexperts.comandcollections@debtrecoveryexperts.comonheracles.mxrouting.net:993 - Fetches UNSEEN messages only (leaves them unread in the mailbox)
- Parses: from, to, subject, date, body (500-char preview + full body), claim_match (DRE-\d{4}-\d{4} pattern)
- Deduplicates by
mailbox:uidcomposite key - Maintains rolling 500-entry JSON database
- Writes to
/var/www/internal/data/dre-mails.json
Output Format
[
{
"uid": 12345,
"mailbox": "dre",
"from": "client@example.com",
"to": "dre@debtrecoveryexperts.com",
"subject": "Question about my claim DRE-2026-0142",
"date": "2026-07-08 14:30:00",
"body_preview": "Hi, I had a question about the status of...",
"body": "Full body text...",
"is_read": false,
"claim_match": "DRE-2026-0142"
}
]
Cron
Runs every 60 seconds via Hermes cron job dre-mail-poller (no_agent mode — zero token cost). The script is self-contained Python stdlib — no pip dependencies.
Access
Served at internal.debtrecoveryexperts.com/data/dre-mails.json (already covered by existing Caddy config — no changes needed).
Portal Integration
A future inbox UI page can fetch from this endpoint and render in the portal. No build step needed — pure JS fetch from the static JSON endpoint.
Mailbox Credentials
- IMAP: heracles.mxrouting.net:993
- dre@debtrecoveryexperts.com / collections@debtrecoveryexperts.com
- Same password for both