jmap-backup-rs
Backup email from a JMAP account to local .eml files.
jmap-backup-rs connects to a JMAP server, queries email, downloads each
message as a raw blob, and stores it under a date-based folder layout:
emails/
2026/
06/
02/
<email-id>.eml
Existing files are skipped, so repeated runs can be used to incrementally update the backup directory.
Status
This is an early release. It currently targets Fastmail-friendly defaults and backs up mail only. Restore, delete detection, mailbox metadata, labels, and contacts are not implemented.
Installation
Install from source with Cargo:
Or clone the repository and build locally:
The optimized binary will be available at
target/release/jmap-backup-rs.
Usage
Create a JMAP API token with permission to read mail, then pass it with
JMAP_TOKEN:
Fastmail is the default endpoint:
https://api.fastmail.com
For a different JMAP service, provide the endpoint explicitly:
Command-line options:
-b, --backup-folder <PATH> Path to the backup folder [default: emails]
-t, --token <TOKEN> JMAP bearer token [env: JMAP_TOKEN]
--url <URL> JMAP API endpoint [env: JMAP_URL]
--redirect-host <HOST> Hosts that redirects may follow [env: JMAP_REDIRECT_HOST]
[default: api.fastmail.com]
-h, --help Print help
-V, --version Print version
Backup Format
Messages are written as .eml files using the message receive date:
<backup-folder>/<year>/<month>/<day>/<email-id>.eml
The tool checks for existing filenames before downloading, which keeps reruns cheap when the backup already contains messages.
Security Notes
Keep your JMAP token private. Prefer the JMAP_TOKEN environment variable over
putting tokens directly in shell history, and revoke the token if it is ever
committed or shared accidentally.
Backups contain the full raw email content, including headers, addresses, message bodies, and attachments. Store the backup directory somewhere private, and encrypt it when appropriate.
Development
Run the formatter and checks before opening a pull request:
Build a smaller optimized release binary with the custom deploy profile:
License
MIT. See LICENSE.