How to backup my emails?

Hi,

I have multiple email accounts from different providers and I want to backup them. I searched for hours and there seems to be absolutely nothing of value and nobody seems to have this problem. Am I the only one wanting to backup my emails???

My current “solution” is to export a .pst file from Outlook. Which I can only bother to like once every few months and is tedious and really annoying for many reasons.

My dream backup would be something like Maildir, which I can sync onto my Synology NAS and also have a Maildir explorer, where I can poke around in the backed up mails.

Yes, I mainly use Windows, but I am grateful for any suggestion and I would even consider Docker containers on my Synology, if it is a really elegant solution to this problem.

Does anyone else have a good working setup? What are you doing with your mails? Do you just not bother, because email for you is disposable? Please share any thoughts you may have :slight_smile:

1 Like

Thunderbird + InportExportTools NG

Or just login to everything with Thunderbird and backup the profile directory.

4 Likes

This seems to be a better alternative to the PST format at least, but still a manual process. Are there more automatic setups possible?

And I seriously cannot understand how there is not a single go-to open-source tool that does this. Do people really not value email backups that they backup literally anything else than email?

If you use Thunderbird you can backup the profile, as you would want other database directory.


There’s also this concept of archiving: Archived Messages | Thunderbird Help

And there are extensions to automatically archive email as soon as it’s received or sent - you can then point SyncThing at the archive path and basically get realtime backups.

I also use Thunderbird to keep a local copy of my cloud emails, which I then backup.
Does my hotmail, gmail and yahoo accounts (remember Yahoo? I am old…)

Haven’t looked at getting Proton working on it, yet, but think there is a “bridge” tool to enable access.

If all your providers support IMAP, isync/mbsync works well, but not sure if there is a Windows port. Could always run it in WSL2. On Arch Linux, this is how I setup syncing from my personal IMAP server to my local machine for backups:

Install isync/mbsync

pacman -S isync

Create ~/.mbsyncrc with the options:

FSync no # I trust my filesystem to not lose data

IMAPAccount mymailhost
Host imap.example.com
SSLType IMAPS # defaults to port 993 (implicit TLS)
User [email protected]
Pass xyz123 # leave this line out and it will prompt for a password

IMAPStore mymailhost-remote
Account mymailhost

MaildirStore mymailhost-local
SubFolders Verbatim
Path ~/mbsync/mymailhost/
Inbox ~/mbsync/mymailhost/inbox

Channel mymailhost
Far :mymailhost-remote:
Near :mymailhost-local:
Patterns *
Sync PullNew PullFlags
SyncState *
Create Near
Remove Near
Expunge Near

Create whatever you put in the “Path” section:

mkdir -p ~/mbsync/mymailhost

Then just run isync --all to kick it off, it’ll download everything the first time, and just sync the changes the next time. If you want it to only ever download mail and never delete it locally, to match deletions you perform on the server, you can do that easily.

More info at isync - ArchWiki and all options at mbsync

I couple this with a shell script which makes a zfs snapshot before it does the sync, the have a cron job that does it every hour. Then I can view my entire mailbox(s) at any point in time in the past, and even show differences between points in time with a diff tool.

Gmail can be synced easily over IMAP, but you probably want to omit the IMAP virtual folders created for tags (if you add N tags to a message, you end up with N copies in different folders).

You could run your own mail intake server. It’s what I’ve been doing. Fetchmail grabs the mail, then I filter it using Procmail and expose it again over IMAPS using Dovecot (Dovecot causes problems with Thunderbird, unfortunately, but there’s other options, like Courier IMAP). That way I have it all on my own hardware, making it easy to backup and it removes any mailbox size limitations providers might have entirely as an added bonus.

This doesn’t keep you from using your provider for outgoing mail (that’s a whole other kettle of fish to self-host and not something I’d necessarily recommend, due to all the blacklisting etc going around)