Skip to main content

Archiving Emails in Thunderbird

This blog post might be outdated!
This blog post was published more than one year ago and might be outdated!
· One min read
Stephan Hochdörfer

For years, I am struggling to find a decent way of archiving / exporting my business mails stored in my IMAP account. Manually copying 10K+ mails is no fun, and addons like the ImportExportTools did also not work properly. So it was clear to to me that I needed to backup the mails on our mailserver and import them somehow into my local Thunderbird instance. The problem to solve was that we use the MailDir format to store the mails on the server side and the ImportExportTools is only able to import mails in mbox format. Thanks to Google I was able to find a one-liner for the conversion, pretty clever if you ask me (at least compared the complex bash and Python scripts I found):

for i in new/* cur/*;do formail <"$i" >> ~/mbox_mails;done

formail is part of the procmail package which you might need to install first. Run this command in the MailDir folder you want to convert to mbox format. When using the ImportExportTools Thunderbird addon to import the mbox file be aware that the addon will create a folder which is named like the file you want to import.