A fast, secure, self-hosted webmail client for any IMAP/SMTP server.
One small binary — Rust on the server, Svelte in the browser.
Roundcube showed that a webmail client can be a small piece of software you run next to your mail server. This is that idea rebuilt with a modern stack: a single Rust binary (a ~70 MB image using ~10 MB of memory) that serves a Svelte app of about 60 KB of gzipped JavaScript, talks to your existing IMAP/SMTP server, and needs only Postgres beside it. It has no user database of its own — people sign in with their mail account.
- Mail — threaded conversations across Inbox and Sent, search in one or all folders,
unread/starred filters, sort by received or sent date, sender, subject or size, star,
move, archive (
e), junk and not junk, delete with Undo, drag messages onto folders, live updates (IMAP IDLE → server-sent events), new-mail desktop notifications and sound. - Filters and out of office — server-side rules (from / to / subject / body / size → move, copy, forward, mark read, star, delete) and an automatic reply with dates, over ManageSieve. Stored in Roundcube's format, so filters made in either client are the same filters; rules written by other programs are kept untouched.
- Writing — plain text or rich text (fonts, sizes, colours, highlight, alignment, indents, tables, lines, links, pasted images sent inline), reply to list, choose the folder the sent copy goes to (or keep none; replies can stay next to the original), undo send, a "forgot the attachment?" check, templates, formatted signatures, send later (the server sends it even with the app closed), saved replies, read receipts, priority, forward inline or as attachment, redirect, attachments up to 25 MB, drafts that autosave, reply/reply-all/forward, identities with signatures, address book with groups and autocomplete (a group expands to its members).
- Folders — create, nest, rename, delete, mark all read; Unicode names; storage used of your quota.
- Reading — view source, download
.eml, print, image attachment previews, long quotes folded, download all attachments as a zip, calendar invitations shown as an event with Yes / Maybe / No (iMIP replies) and Add to calendar, read-receipt requests answered or declined once (or answered automatically, as you choose: always, only to your contacts, never), a contact card attached to a message added with one click, the sender's contact photo, snooze (back in Inbox, unread, at the time you pick), one-click unsubscribe from mailing lists, PDFs open in the browser's viewer. - Tidy inbox — block a sender and mute a conversation (server-side filters, so
they work with the app closed), storage page with folder sizes and the largest messages,
print a whole conversation,
?for every shortcut. - Organising — five colour labels (Thunderbird's), search operators (
from:has:attachmentafter:larger:label:…) and a search form, "filter messages like this", hide folders from the list, import / export (.eml, mbox, zip; contacts as vCard). - Account — change your password (with
PASSWORD_API_URL), sign out after inactivity. - Built for real use — fast on 20,000-message folders (~12 ms per page), opened
messages cached and the next one preloaded so
j/kfeel instant, a calm "reconnecting" banner when the mail server is slow or down, Junk / Not junk moves that train the mail server's spam filter when it learns from them (e.g. Rspamd'sRSPAMD_LEARNin docker-mailserver), sign back in over the page when a session expires without losing what you were writing. - Accessible — keyboard-first (
j/k,r,#,/… see Settings → About), screen reader labels and announcements, WCAG 2.1 AA contrast in light and dark themes, reduced motion. Checked automatically in CI. - Mobile — one-pane layout with a folder drawer; swipe a message to archive it or mark it read, pull the list down to refresh. Installable as an app (Settings → General → App; on iPhone, Share → Add to Home Screen) with a Compose shortcut and the unread count on its icon.
- Reading and writing preferences — mark messages read at once, after a few seconds or never; the browser's own spell checker, in the language you choose.
- Address book — several addresses and phone numbers per person, nickname, organization and department, job title, postal address, website, birthday, notes and a photo; import vCard or CSV (Gmail, Outlook) with their groups, export vCard.
Email is hostile input, and a webmail client holds the keys to the mailbox. The design assumes both:
- Message HTML never runs. It is sanitized on the server (ammonia) and shown only in
an
<iframe sandbox>with neither scripts nor same-origin access. Remote images and CSS are stripped until the user asks (or per preference: never / from contacts / always). - Passwords are never stored in recoverable form. Signing in is an IMAP LOGIN. The
session row holds the password encrypted under a key that exists only in the user's
cookie, so a database dump alone yields nothing usable. Send later and snooze (only with
SCHEDULE_KEYset) keep the password while something is pending, encrypted under that server key, and delete it when nothing is left — as Roundcube does for its sessions. - Strict CSP (hashed inline bootstrap, no third-party origins), CSRF tokens on every
mutation,
SameSite=Strictcookies, login rate limiting per IP and per account. - Implicit TLS only to the mail server (IMAPS 993, SMTPS 465). ManageSieve has no implicit-TLS port: that connection is upgraded with STARTTLS and refuses to sign in without it.
- The From address is always the signed-in account. Identities change only the display name, Reply-To and signature.
- Attachments, "view source" and print pages are served under a
sandboxCSP; only raster images (never SVG) are displayed inline.
Found a problem? See SECURITY.md.
git clone https://github.com/orshih6/webmail && cd webmail
docker compose -f docker-compose.demo.yml up -d # first run builds from source: ~5–10 minOpen http://localhost:8080 and sign in as demo@example.test / demo. A bundled
test mail server (docker-mailserver, private network, self-signed certificate) holds two
accounts — write to friend@example.test, then sign in as friend / friend to read it.
docker compose -f docker-compose.demo.yml down -v removes everything.
You need an IMAP/SMTP server reachable over IMAPS (993) and SMTPS (465).
git clone https://github.com/orshih6/webmail && cd webmail
cp .env.example .env # set IMAP_HOST (and SMTP_HOST if it differs)
docker compose up -dIt listens on 127.0.0.1:8080. For anything beyond your own machine, put an HTTPS
reverse proxy (Caddy, nginx, Traefik…) in front of it. A Kubernetes example is in
deploy/kubernetes/.
All configuration is environment variables.
| Variable | Default | |
|---|---|---|
IMAP_HOST |
— (required) | IMAPS server |
SMTP_HOST |
— (required) | SMTPS server |
DATABASE_URL |
— (required) | Postgres, e.g. postgres://user:pass@host/webmail; migrations run at startup |
IMAP_PORT / SMTP_PORT |
993 / 465 |
implicit TLS ports |
SIEVE_HOST |
— | ManageSieve server for filters and out-of-office (port 4190, STARTTLS); unset hides them |
SIEVE_PORT |
4190 |
|
SIEVE_TLS_NAME |
SIEVE_HOST |
name the sieve certificate is checked against, when SIEVE_HOST is an internal address |
PASSWORD_API_URL |
— | where passwords change: PATCH {url}/users/{email} with {"password": …}, as docker-mailserver's dms-admin offers; unset hides it |
PASSWORD_API_KEY |
— | bearer token for that API |
SCHEDULE_KEY |
— | 32 bytes, base64 (openssl rand -base64 32): turns on send later and snooze, and encrypts the password they keep while something is pending; unset hides them |
APP_NAME |
Webmail |
name shown in the UI, page titles, installed app and User-Agent |
SOURCE_URL |
this repository | link to the source of the version you run (AGPL §13 — point it at your fork if you modify it) |
MAIL_TIMEOUT_SECS |
30 |
how long a request may wait on the mail server (sending gets 4×) |
MESSAGE_CACHE_MB |
64 |
memory for parsed, sanitized messages (per user, 15 min, flags always fetched fresh); 0 disables |
LISTEN_ADDR |
0.0.0.0:8080 |
|
COOKIE_SECURE |
1 |
0 only for local http testing |
TLS_ACCEPT_INVALID_CERTS |
0 |
1 only for a dev server with a self-signed certificate |
Run a single instance: IMAP connections are pooled in memory (one per user, plus one for
live updates — Dovecot's default mail_max_userip_connections of 10 is plenty).
dev/up.sh # docker-mailserver + Postgres with test accounts
source dev/dev.env
(cd web && pnpm install && pnpm build)
cargo run # http://localhost:8080 — alice@example.test / alicepasscd web && pnpm dev gives hot reload on :5173 (proxies /api to the Rust server).
Tests, all of which run in CI against a real mail server:
cargo test # unit tests
WEBMAIL_IT=1 cargo test --test integration # API against the dev mail server
e2e/run.sh # browser walkthroughs + accessibility auditArchitecture notes and the invariants contributors must keep are in CLAUDE.md; what's planned is in ROADMAP.md.
GNU Affero General Public License v3.0. You may run, study, change and share
it; if you offer a modified version to users over a network, you must offer them its
source too (set SOURCE_URL).



