Files
metabuilder/smtprelay
johndoe6345789 5c801b7298 refactor(fakemui): promote directories to first-class naming
Directory Renamings (git moves preserve history):
- qml/components-legacy/ → qml/hybrid/ (QML/JS hybrid components)
- legacy/utilities/ → utilities/ (core utilities)
- legacy/migration-in-progress/ → wip/ (work-in-progress)
- qml/qml-components/qml-components/ → qml/components/ (flatten nesting)

Removals:
- legacy/ directory (now empty)
- python/fakemui/ (empty directory)
- python/ (now empty)

Documentation Updates:
- STRUCTURE.md: All path references updated to reflect new structure
- docs/ACCESSIBILITY_STATUS.md: legacy/migration-in-progress/ → wip/
- qmldir: Updated all 135 component registrations (qml-components/ → components/)

Result:
- No "legacy" terminology in directory names
- No redundant nesting (qml/qml-components/qml-components/)
- All directories have first-class, descriptive names
- 135 QML component registrations updated in qmldir
- Full git history preserved through rename tracking

Co-Authored-By: Claude Haiku 4.5 <noreply@anthropic.com>
2026-01-23 18:35:10 +00:00
..
2026-01-21 17:05:30 +00:00
2026-01-21 17:05:30 +00:00
2026-01-21 17:05:30 +00:00
2026-01-21 17:05:30 +00:00
2026-01-21 17:05:30 +00:00

Twisted SMTP Ingest + Gmail Relay + HTTP Stats

Set SMTP_LISTEN_HOST=0.0.0.0 and HTTP_LISTEN_HOST=0.0.0.0 so Twisted binds the SMTP and HTTP listeners to all interfaces.

  • SMTP server (Twisted) listens on a non-privileged port (>1024) and accepts mail.
  • SMTP client (Twisted) relays received mail to Gmail SMTP (submission) via STARTTLS.
  • HTTP server (Twisted Web) serves a simple dashboard with:
    • server stats (uptime, counters)
    • list of relayed messages (recent first)
    • per-message detail view

Install

python -m venv .venv
# Windows:
.venv\Scripts\python -m pip install -r requirements.txt
# Linux/macOS:
.venv/bin/python -m pip install -r requirements.txt

Configure (environment variables)

Required:

  • GMAIL_USERNAME
  • GMAIL_APP_PASSWORD
  • FORWARD_TO (comma-separated list)

Optional:

  • SMTP_LISTEN_HOST (default: 127.0.0.1)
  • SMTP_LISTEN_PORT (default: 2525, must be >1024)
  • HTTP_LISTEN_HOST (default: 127.0.0.1)
  • HTTP_LISTEN_PORT (default: 8080, must be >1024)
  • GMAIL_HOST (default: smtp.gmail.com)
  • GMAIL_PORT (default: 587)
  • RELAY_FROM (default: GMAIL_USERNAME)
  • ALLOW_ANY_RCPT (default: true) - if false, only accept RCPT that match FORWARD_TO.
  • ADD_X_HEADERS (default: true) - add X-Original-* headers.
  • MAX_STORE (default: 200) - max number of message records kept in memory.

Run

PowerShell:

$env:GMAIL_USERNAME="you@gmail.com"
$env:GMAIL_APP_PASSWORD="xxxx xxxx xxxx xxxx"
$env:FORWARD_TO="you@gmail.com"
$env:SMTP_LISTEN_PORT="2525"
$env:HTTP_LISTEN_PORT="8080"
.venv\Scripts\python -m smtp_relay.main

Open dashboard:

Send a test email (to your local relay)

python scripts/send_test_mail.py --host 127.0.0.1 --port 2525 --to you@gmail.com

Tests

python -m unittest -v

Security notes

This is intended for local / controlled networks. If you expose it publicly:

  • firewall/VPN it
  • authenticate clients
  • rate limit
  • set ALLOW_ANY_RCPT=false

Docker

Build and run with compose:

docker compose up --build

Then:

Provide env vars via your shell or a .env file:

  • GMAIL_USERNAME
  • GMAIL_APP_PASSWORD
  • FORWARD_TO