iSMAIL / quickstart

The CLI is the contract

Every imapsync flag works the way you already know: same spellings (325 accepted forms generated from imapsync 2.326), same exit codes, same statistics-style transcript. --optionsfile, negations (--nofoldersizes), repeated options (--exclude A --exclude B), presets (--gmail1, --office1) and --f1f2 / --regextrans2 folder mapping included.

# plan a sync without touching any 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
situationexit code
--help / --version / sync OK0
sync / protocol / auth failure1
unknown option64
missing credentials101

All four verified live against the production imapsync binary.

One static binary, one image

Statically linked musl build, pure-Rust TLS (rustls) with embedded trust roots — no CA bundle, no Perl, no CPAN, nothing to install into the container. The image runs as USER 65534 on scratch.

# build (needs only the Rust toolchain + musl target)
cargo build --release --target x86_64-unknown-linux-musl

# or build the image: 4.9 MB static binary on a scratch base
docker build -t ismail:0.9.0 --build-arg VERSION=0.9.0 .

Serving the API, UI and scheduler

--serve starts the long-running mode: HTTP API + embedded web UI + in-process cron scheduler. One binary, no host crons, no sidecars.

flagmeaningdefault
--servestart API/UI/scheduler instead of a one-shot syncoff
--listen <addr:port>bind address127.0.0.1:8120
--apitoken <T> / --apitokenfile <f>required bearer token for every request (file is trimmed)none — API is unauthenticated without one
--schedulefile <f>where schedules are persisted (atomic writes)schedules.json
--authuser <u> / --authpassfile <f>UI login with a username/password (browser gets a session cookie; scripts keep using the bearer token)off
--oidc-issuer + --oidc-clientid + --oidc-clientsecretfile + --oidc-redirectUI login via OIDC (Keycloak, Authentik, Entra ID …); optional --oidc-allowemails a@x,b@yoff
UI login — put a 600-mode password file next to the token file and add --authuser admin --authpassfile /data/authpass to the command. For SSO, register a confidential OIDC client with redirect URI https://<your-host>/api/oidc/callback (PKCE is always on, but a client secret is required), then --oidc-issuer https://cloak.example.com/realms/main --oidc-clientid ismail --oidc-clientsecretfile /data/oidcsecret --oidc-redirect https://<your-host>/api/oidc/callback. Sessions live 8 h in memory; a restart logs everyone out.
docker run -d --name ismail \
  -p 127.0.0.1:8120:8120 \
  -v ./ismail-data:/data \
  ismail:0.9.0 \
    --serve --listen 0.0.0.0:8120 \
    --apitokenfile /data/token \
    --schedulefile /data/schedules.json
The container runs as uid 65534: the mounted directory must be writable by it (sudo chown 65534 ismail-data), or the schedule file cannot be persisted.

Push mode: --idle1 (mail the moment it lands)

Instead of waiting for the next schedule tick, --idle1 uses IMAP IDLE (RFC 2177) — the push mechanism built into the protocol, which imapsync never exposed. iSMAIL syncs immediately at start, then holds an open IDLE connection on the source INBOX; the server pushes * N EXISTS the instant new mail arrives and the next sync starts within about a second. It re-issues IDLE every 2 minutes (servers cap sessions at ~29 min), reconnects with backoff on drops, and — importantly — a failed sync round retries after backoff rather than waiting for a push that a broken destination could never trigger. Gmail, GMX, iCloud, Dovecot and Stalwart all support IDLE (the capability is checked the same way CAPABILITY reports it).

# one-shot today, push watcher tomorrow - same flags either way
ismail --idle1 --optionsfile /data/gmail.flags   # the .flags file holds the usual sync args
IDLE pushes the notification, not the message — the fetch still runs normally, right after. And the watch is on the source INBOX: mail that arrives directly into an odd subfolder won't wake it. The recommended production shape is therefore --idle1 for immediacy plus one nightly scheduled sweep as the safety net.

Running permanently with docker compose

The intended production shape: one compose service that stays up, serves the UI, and fires its schedules itself — no host crons, no wrapper loops. The binary doubles as its own healthcheck (the image has no shell, so use the CMD form):

# docker-compose.yml
services:
  ismail:
    image: ismail:0.9.0
    restart: unless-stopped
    command:
      - --serve
      - --listen
      - 0.0.0.0:8120
      - --apitokenfile
      - /data/token
      - --schedulefile
      - /data/schedules.json
    ports:
      - "127.0.0.1:8120:8120"   # keep it on loopback; put TLS in front
    volumes:
      - ./data:/data            # token + schedules.json (protect this dir!)
    healthcheck:
      test: ["CMD", "/ismail", "--version"]
      interval: 60s
      timeout: 5s
      retries: 3

The push watcher is a second one-line service — sync flags live in an options file so they never appear in the process list:

  # in the same docker-compose.yml
  ismail-push:
    image: ismail:0.9.0
    restart: unless-stopped
    command: ["--idle1", "--optionsfile", "/data/gmail.flags"]
    volumes: ["./data:/data"]   # gmail.flags: chmod 600, same care as the token

Give the container a real hostname in front of it with your reverse proxy (Caddy/Traefik/nginx): terminate TLS there and either pass through the bearer token or require the proxy's own auth on top. docker compose up -d, then open the UI and add your schedules — the compose service is the only moving part.

Troubleshooting a sync

ISMAIL_DEBUG=1 prints a redacted IMAP command/response trace for the run — credentials never appear in it, nor in transcripts fetched from the API.

Security notes

And no, there is no ISO badge here — on purpose

You may have seen software advertise "ISO 27001" (correctly: ISO/IEC 27001, the information-security-management standard people mean when they ask for "the security ISO"). It is a certification of an organization's processes, issued by an accredited auditor after formal audits — a solo open-source project cannot honestly claim it, and anyone who prints the logo without a certificate is just doing marketing. iSMAIL doesn't.

What it does instead is real, checkable work: TLS-only wire protocol (rustls, validated certificate chains, embedded trust roots — no plaintext fallback when --sslN is set), loopback bind by default, bearer auth on every endpoint, transcripts that redact credentials, a scratch image with no shell, no package manager and no dependencies, a non-root uid — plus actual process: dependency vulnerability scanning against OSV.dev in every CI run with a dated accepted-risk register, and a disclosure policy (SECURITY.md). The full control-by-control compliance page says what we implement and what we honestly don't.