Exporting your emails as an MBOX file

As I was publishing the code for Memeoirs Redux, I realized I could use a refresher on how to create an MBOX file to process.

Gmail handles importing of messages from different providers pretty well, so for the sake of this how-to, I’ll assume that your emails are either stored on Gmail or that you have imported them on Gmail from somewhere else.

  1. select the conversations you are interested in processing. You can do this from Gmail’s interface, or later from Thunderbird, but I find that doing this on Gmail is faster, in part because the search is instantaneous. Create a label/folder and start drag-and-dropping all the emails you are interested in saving into it. Gmail is usually smart about copying the entire thread but do double-check that both your messages and the one of your recipient(s) are copied into the folder.
  2. Download and install Thunderbird.
  3. Configure Thunderbird to connect with your Gmail account. Gmail has recently made the process clunkier and messier, but it’s still possible to use IMAP to access your mailbox.
  4. At this point, you should be able to see your label/folder on Thunderbird, and all the messages you selected. Go through them one by one, and perform the following operations: delete a message if you are actually not interested in it; if the message contains an attachment, delete the attachment (right click on the file, delete); this step takes time, but ultimately if you are doing this because you want to print those emails, you’ll have a more legible book as a result of the editing. Also, notice that going through them one by one is what makes Thunderbird download the message (instead of just the metadata of the message). There might be a faster way to do this in case you want to skip this important filtering phase.
  5. Compress the folder by right-clicking on its name and selecting “Compact”.
  6. Time to harvest. This step will change a bit depending on what platform you are on (Windows, Max or Linux). From your Thunderbird-GMail settings, you should see the directory/folder in which data has been stored on your local drive.
  7. Go to that directory/folder and look for a file that has the same name as the label/folder you originally created on Gmail. That’s your MBOX file. There will be also another file with the same name, but with extension .msf. You can ignore that. Copy that file to the same location where you downloaded Memeoirs Redux.


And that’s it, really. After you turned the MBOX file into an html file with Memeoirs Redux, and before processing the html file with Prince to turn it into a PDF, you can give the last high-touch pass to your content, for instance removing unwanted reply lines that weren’t filtered. Just don’t change the original messages, will ya? You’re not allowed to change history. 😛 If you have a lot of messages in your book, you may want to open the html file with an editor capable of dealing with large text files, such as Sublime Text.

Have fun!

Leave a Reply

Your email address will not be published. Required fields are marked *

Name *