r/fastmail • u/AnalogManDigitalKid • 4d ago
fastmail-python-export-tool: a Python script to back up your mail, calendars, contacts and aliases
I wanted repeatable local backups of my Fastmail account, so I put together a small Python tool. Disclosure: the code was written by AI (Claude), with me directing and reviewing it. It's been working for my own account, but please read the code before trusting it with yours.
What it exports, each run as a full dated snapshot:
- Mail as
.emlfiles in your folder structure, with Trash or any other folder excluded - Calendars as
.ics, one combined file per calendar plus one per event - Contacts as
.vcf, one per address book plus one per contact - Aliases as CSVs of your sending identities and Masked Email addresses
How it logs in. Pick one:
- Separate app passwords for IMAP, CalDAV and CardDAV, plus a read-only API token for aliases. This is the default and gives each credential the least access.
- One app password for everything
- The API token for nearly everything. Calendars still need an app password, because the API has no calendar scope.
It's read-only on the Fastmail side and needs Python 3.11+ with no extra packages. Each export can be switched on or off in a simple TOML config, and there's a double-click launcher for Windows.
⚠️ Please run it on encrypted storage. The config holds your credentials in plain text, and the output is your entire mailbox in readable form. I keep everything in a VeraCrypt container: mount, run, dismount. Keep it out of cloud-synced folders.
One thing it can't do is export Filters & Rules, because Fastmail doesn't make them available to any of the access methods it uses. Export those by hand from Settings → Filters & Rules.
Repo: https://github.com/AnalogManDigitalKid/fastmail-python-export-tool
Feedback and bug reports welcome!
1
u/Numerous_Platypus 4d ago
https://github.com/s1t5/mail-archiver
2
u/SwimmingLimpet 4d ago
Or, one could install the Thunderbird client and add one's Fastmail account to it.
If snapshots are necessary, add the Thunderbird profile folder to one's existing workflow for data backups.
1
u/WentThisWayInsteadOf 3d ago
I imap-backup, it'll not do calendar nor contacts, but for me mail is the thing.