What it does
Receive
Email Routing hands mail to a Worker, which spools it to R2 and wakes your container to parse, thread and index it.
Read and search
A server-rendered web app with threads, full-text search, snooze, expiry, and junk and phishing rules.
Write
Compose, reply and forward with drafts and a Sent folder, sent through Cloudflare Email Sending.
Gmail
Your own OAuth client: backfill, push, archive and send-as, kept in step with LeanMail.
Sign in
Passkeys, a magic link or a six-digit code. Scoped API tokens for the CLI and the apps.
AI, if you want it
Optional triage, summaries and reply suggestions over any OpenAI-compatible endpoint. Privileged mail is never sent.
Everywhere you read mail
- Web: server-rendered pages, phone first, light and dark.
- Command line:
leanmailsearches, reads, imports .eml and mbox, sends, and runs as an MCP server for AI tools. - iPhone, iPad and Mac: native apps written in Lean with LeanNative.
How it fits together
mail ─► Email Routing ─► Worker ─► R2 spool ─► your account's container browser / CLI / app ─► Worker (cookie or token) ─► your container ─► Lean server Lean server ─► SQLite (FTS5), replicated to R2 by Litestream
One container per account, a thin fixed Worker, and no end-to-end encryption: the server reads your mail so it can index and render it. Read the architecture and security notes before you trust it with yours.
Run your own
You need a Cloudflare account with Workers Paid (for Containers), a domain on Cloudflare, and about an hour. The self-hosting guide walks through it.