Open-source IMAP backup with point-in-time snapshots. imapvault keeps deleted mail for a grace period, notices when a mass deletion happens, and restores any snapshot, folder or message.
Someone gets into your account, deletes everything and empties the trash. A mirror copies that deletion. imapvault does not: the next run notices, raises an alert, pins the last good snapshot and exits with code 3. imapvault restore puts the mail back.
backup reads the mailbox in one read-only session and stores each distinct message once, compressed and, if you want, encrypted with age.forget and prune apply a retention policy. Mail deleted from the server stays restorable for 180 days by default, and pins and open alerts always win.restore shows exactly what it would add, then waits for a plan token you copy from the preview.# every hour, from cron or a systemd timer
imapvault --account personal backup
# what changed between two snapshots
imapvault --account personal diff latest~1 latest
# undo the hack: preview first, then approve with the token it prints
imapvault --account personal restore --deleted-since 7d --in-place
EXAMINE and BODY.PEEK[], and a test fails the build on any write command.allow_append = true in the target account's config plus an approved plan token.prune removes data from the repository, and it honours pins, the grace period and unacknowledged alerts.One static binary for Linux and macOS, on amd64 and arm64. The script checks the download against the published checksums before it installs anything, and puts imapvault in ~/.local/bin.
curl -fsSL https://imapvault.sh/install.sh | sh
Or brew install michele/imapvault/imapvault, or the container image ghcr.io/michele/imapvault. Prefer to read the script first? install.sh is short. You can also take an archive from the releases page. The macOS binaries are not signed, so Gatekeeper refuses the first run: xattr -d com.apple.quarantine imapvault. To run it on a schedule, see the systemd units and cron notes or the Docker guide.
Version 0.1, alpha. Backup has run against a dovecot test server and a Fastmail mailbox. Restore has only been run against the test server, so try it on a throwaway account before you point it at a mailbox you care about.
Use it at your own risk. It is released under the MIT licence with no warranty, and a backup you have never restored is a hope, not a backup.
What is and is not verified is listed milestone by milestone in the plan.