Disclaimer This project is not an official ProtonMail client. It is an experimental CLI implementation that leverages the open-source Go Proton API (github.com/ProtonMail/go-proton-api).
The ProtonMail Bridge codebase (github.com/ProtonMail/proton-bridge) is a paid alternative that provides a local IMAP proxy.
The CAPTCHA workflow was reverse-engineered from Proton’s WebClient to support manual validation in this CLI.
- IMAP/SMTP Integration
I wanted to connect ProtonMail to Outlook over standard IMAP/SMTP protocols. - End-to-End Encryption
ProtonMail encrypts all messages client-side, preventing a simple IMAP/SMTP client from accessing plaintext. - ProtonMail Bridge
The official Bridge exposes a local IMAP proxy but requires a paid subscription. - Go Proton API
The Bridge uses the open-source Go librarygo-proton-api, which is available without license restrictions. - Lack of Documentation
There is no formal documentation for exporting messages or contacts; a 2023 issue highlights this gap. - CLI Prototype
I began a command-line tool to export emails and monitor incoming messages in real time. - CAPTCHA Handling
CAPTCHA logic is borrowed from Proton’s WebClient (window.postMessage) and integrated as a manual step in this CLI. - Implementation
After reviewing the Bridge and WebClient code, I implemented message export and PGP decryption. - Publication
This repository captures the results of those experiments.
A minimalist command-line client for ProtonMail that retrieves, decrypts, and watches your emails in real time. It fully reconstructs MIME messages for SMTP compatibility.
- OAuth-style authentication via the official Go API
- Manual CAPTCHA validation through a web browser
- Two-factor authentication support (2FA/TOTP)
- Load credentials from a JSON configuration file
- Retrieve and decrypt ProtonMail messages locally
- Real-time monitoring of incoming messages
- Complete MIME reconstruction (headers, body, attachments)
.
├── bin/
│ ├── config.json.example # Sample configuration file
│ └── cookies.json # Persistent cookie jar (generated)
├── cmd/
│ └── protonmail/ # Application entry point
│ └── main.go
├── internal/
│ ├── client/ # ProtonMail API wrapper
│ │ └── proton\_client.go
│ ├── config/ # Configuration and constants
│ │ ├── config.go
│ │ └── constants.go
└── build.sh # Build script
- Copy the example configuration:
cp bin/config.json.example bin/config.json- Edit
bin/config.jsonwith your credentials:
{
"username": "your.email@proton.me",
"password": "your_password",
"totpSecretKey": "your_totp_secret" // optional
}Run the build script to compile the binary:
./build.shThe executable will be generated at bin/protonmail.
cd bin && ./protonmailOn launch, the client will:
- Authenticate to your ProtonMail account (CAPTCHA + 2FA flow)
- Display the most recent message
- Monitor and display new messages in real time
- Credentials are stored in an isolated JSON file
- Session cookies are persisted to minimize repeated logins
- All messages are decrypted locally using your mailbox password
- Optional TOTP support enhances account security