iSMAIL
A from-scratch Rust rewrite of imapsync — same command line, same log output, plus a web API, a UI and a scheduler, in one 4.7 MB static binary.
Why
imapsync is the de-facto standard for mailbox-to-mailbox IMAP migration and sync. It is Perl, it has no API, and scheduling means hand-written shell loops. iSMAIL keeps the exact behaviour you depend on and adds what never existed: a single-binary Rust engine, an HTTP API covering every CLI option, and a web UI with an in-process scheduler — all in one deployable image.
Any IMAP server works (password/app-password auth) — the engine speaks standard
IMAP4rev1 over TLS and STARTTLS, exactly like imapsync: Dovecot, Stalwart, Courier, Gmail,
GMX, iCloud… Gmail/Outlook quirks are covered by the same presets (--gmail1,
--office1). XOAUTH2 token login — what MS Exchange and Fastmail now demand — is
on the roadmap. The live verification set just happens to be Gmail + GMX + iCloud →
Stalwart.
What you get
--idle1 rides IMAP IDLE (RFC 2177): the source server pushes EXISTS the moment mail lands and the next sync starts ~1 s later — with renew, reconnect and backoff. Schedules become the safety net. imapsync never had this.scratch base: embedded TLS roots, non-root, no dependencies.CLI, exactly as you know it
# drop-in: same flags, same semantics, --dry plans without touching mail
ismail --host1 imap.gmail.com --user1 you@gmail.com --password1 'app-pass' \
--ssl1 --gmail1 \
--host2 mail.example.com --user2 you@example.com --password2 'secret' --ssl2 \
--delete1 --syncinternaldates --dry
No dependencies (pure-Rust TLS), no Perl, no CPAN. --optionsfile, negations
(--nofoldersizes), repeated options (--exclude a --exclude b),
presets (--gmail1, --office1) and --f1f2/--regextrans2
folder mapping all behave like the original.
Quickstart →
Verified against the real thing
- Production parity: four live mailboxes (Gmail, GMX, iCloud) run side by side with
imapsync 2.326 in
--drymode — 4/4 identical copy plans, duplicate and headerless-message counts and folder mappings matching exactly. - Real (non-dry) parity: live test accounts, 12/12 messages transferred, destination Message-ID sets identical, rerun transfers 0 (idempotent).
- Exit codes 0 / 1 / 64 / 101 verified against the production binary, not guessed.
Bugs the original still ships — fixed here
- TLS validation is always on. imapsync's default is
SSL_VERIFY_NONE(hardcoded in its source; its own log suggests a flag if you want cert checks). iSMAIL's rustls validates chain and hostname on every connection — no opt-out, and no plaintext fallback when--sslNis set. - Failed protocol commands are errors, not empty results. Upstream
issue #561 (open): a failed
SEARCH reads as "nothing to sync" and mail is silently skipped. iSMAIL makes
NO/BADon SEARCH/LIST hard failures, and a refusedSTORE/EXPUNGEaborts the--delete1path instead of lying in the transcript — all pinned by failure-injection tests. - Regexes can't hang a sync — Rust's linear-time engine, no catastrophic backtracking.
- Orchestration included — where the original's manpage says "write your own shell program", iSMAIL ships the API, run history and scheduler.
Status
| Area | State |
|---|---|
| CLI contract: 325 spellings, exit-code parity | done |
| Engine: TLS, presets, automap, include/exclude, dedup, dry plans | done |
| Real (non-dry) sync parity: 12/12 identical on live test accounts, idempotent rerun | done |
Production parity: 4/4 live mailboxes MATCH on --dry (vs imapsync 2.326) | done |
| Log-output parity: statistics, folder loop, automap lines | done |
| Web API (all CLI options over HTTP) | done |
| Web UI + in-app scheduler | done |
| Fat image: 4.9 MB musl binary on scratch, OCI-labelled, CI size budget (6.5 MB) | done |
IDLE push mode --idle1 (v0.5.0, mock-tested incl. drop/reconnect) | done |
| UI login (v0.7): classic user/password and OIDC SSO (Keycloak/Authentik/Entra), session cookie; bearer token stays the script path | done |
| Replacing a live production imapsync deployment | your call — run it beside your current setup with --dry first |
Links
- Source: github.com/handtrixx/iSMAIL (
main) - Original: imapsync — iSMAIL is an independent AGPL-3.0 reimplementation, not a fork