Skip to content

Export and archives

antiphon export writes an account's whole Maildir to one encrypted file. antiphon view opens that file later, on any machine, with no account, server or daemon. Keep the file, read it whenever.

Make an age key

Archives are encrypted with age. Install it first:

brew install age        # macOS
sudo pacman -S age      # Arch
sudo apt install age    # Debian/Ubuntu

Generate a key once:

mkdir -p ~/keys
age-keygen -o ~/keys/age.txt

This writes your private identity to ~/keys/age.txt and prints your public key (age1...). You encrypt to the public key and decrypt with the file. Back ~/keys/age.txt up somewhere safe: lose it and the archives are unreadable.

Print the public key again any time:

age-keygen -y ~/keys/age.txt

Export an account

antiphon export work -o ~/archives -r age1qxy...

Put your own age1... public key after -r. This writes work-2026-07-28.tar.gz.age (today's date) into ~/archives. Repeat -r to let more than one key open the archive. Omit the account name to export every account, one file each.

To encrypt to a passphrase instead of a key:

antiphon export work -o ~/archives -p

From inside the client, :export work ~/archives encrypts to the keys in your config:

[export]
recipients = ["age1qxy..."]

Read an archive

antiphon view ~/archives/work-2026-07-28.tar.gz.age -i ~/keys/age.txt

The full interface opens read-only over the archive: reading, search, threading and attachments all work, with no account and no daemon. Use -p instead of -i if you exported with a passphrase.

On exit it prints where it unpacked the archive and the rm -r command to clear it; reopening the same file is instant.

Incremental snapshots

An export rewrites the whole mailbox every time. antiphon archive instead adds only what is new: each run encrypts the messages that have arrived since the last one into a fresh snapshot, so a scheduled job keeps a growing encrypted record without ever re-encrypting the mail it already holds.

antiphon archive work -o ~/archives -r age1qxy...

Snapshots land under ~/archives/work/, each named for the UTC second of the run, for example 20260812T063000Z.tar.gz.age. A manifest.txt beside them is the watermark: it lists every message already archived, so the next run knows what to skip. A run that finds nothing new writes no snapshot at all. The same -r (repeatable) and -p options as export choose the recipients or a passphrase, and omitting the account archives every configured account into its own subdirectory.

Read any snapshot exactly like an export:

antiphon view \
  ~/archives/work/20260812T063000Z.tar.gz.age -i ~/keys/age.txt

On a schedule

Snapshots read straight from the local Maildir, so no client or daemon has to be running. Drive them from cron, say every night at two:

0 2 * * * antiphon archive work -o ~/archives -r age1qxy...

Or as a systemd user timer. Drop a service and a timer into ~/.config/systemd/user/:

# antiphon-archive.service
[Service]
Type=oneshot
ExecStart=%h/.local/bin/antiphon archive work \
    -o %h/archives -r age1qxy...
# antiphon-archive.timer
[Timer]
OnCalendar=daily
Persistent=true

[Install]
WantedBy=timers.target

Enable it with systemctl --user enable --now antiphon-archive.timer. Because each run only touches new mail, running it often stays cheap.

Leaving a job

# while you still have access:
antiphon export work -o ~/archives -r age1qxy...

# any time later, on any machine:
antiphon view ~/archives/work-2026-07-28.tar.gz.age -i ~/keys/age.txt

Back up the one file. Anyone holding ~/keys/age.txt (or the passphrase) can read it; nobody else can, and it never needs the account, its server or its password again.