Minimal, autonomous ProtonMail reader using Playwright + Firefox. Fetch new unread emails as plain Python objects and pipe them anywhere (Signal/Telegram/WhatsApp/email/webhook).
- Reads ProtonMail without IMAP (uses browser API via Playwright)
- No secrets hardcoded — uses
.envor existingfirefox-profilesession - Plugable handler: call any async/sync function per email
- Keeps track of processed
conv_idinstate.json - Works with existing X11/Display (or headless + xvfb)
cd protonmail-reader
cp .env.example .env
# Edit .env if needed (PROTON_EMAIL/PROTON_PASSWORD optional if logged in)
pip install -r requirements.txt
playwright install firefoxDry-run (just print):
export DISPLAY=:1 # or set in .env
python cli.py --dry-run --handler protonmail_reader.examples.print_only:handleProcess & mark:
python cli.py --handler protonmail_reader.examples.print_only:handleCustom handler:
python cli.py --handler mymodule:process_emailSMTP example:
export SMTP_HOST=mail.riseup.net SMTP_PORT=587 SMTP_USER=you@riseup.net SMTP_PASS=pass FORWARD_TO=dest@riseup.net
python cli.py --handler protonmail_reader.examples.forward_smtp:handleWebhook example:
export WEBHOOK_URL=https://example.com/hook
python cli.py --handler protonmail_reader.examples.post_webhook:handle- If already logged in,
firefox-profile/is reused (fast, no login). Do not commit it. - First login may require CAPTCHA/2FA — run with visible DISPLAY once.
- Only single-message conversations are processed by default (
INBOX_ONLY_SINGLE=true). Tune via env. - BODGE-y: relies on Proton's UI/iframes; if Proton changes, extraction may need tweak (frame selection + nav filter).
- State grows but capped (~5000 ids) — safe for long-running.