Importing MH email archives into Thunderbird

I recently decided to resurrect some personal email archives from the 1990s. Back then I used an email client that saved messages in the ‘MH’ mail box format. Today I use Thunderbird under FreeBSD. Inspired by this page, I’m summarising here how I imported my old MH emails into Thunderbird. (This is of archival value to me. And possibly useful to you, if you’re reading this and you’re not me.)

Short version

Use the packf command from the nmh mail system (available in the FreeBSD Ports tree under /usr/ports/mail/nmh) to convert mh folders into mbox files, then manually import the resulting mbox files into a suitable Thunderbird .sbd directory.

Install NMH

I used portmaster to install nmh:

gjabkup2# portmaster /usr/ports/mail/nmh
===>>> Port directory: /usr/ports/mail/nmh
[...]
===> Cleaning for nmh-1.3

===>>> Installation of mail/nmh (nmh-1.3) complete

gjabkup2#

Utilise packf

The general syntax for converting MH to mbox is:

% packf +SAVED -mbox -file SAVED_mbox

where SAVED refers to an existing MH mailbox, and SAVED_mbox is the target mbox file you’re going to create (containing all the emails from the SAVED mailbox).

First, run install-mh to configure a local MH mailbox system

gja@gjabkup2.space4me.com :install-mh
[...blah, created /home/gja/Mail as default mh mail location...]
gja@gjabkup2.space4me.com :

Now copy in my MH archives:

gja@gjabkup2.space4me.com : rsync -av <MHarchive>   /home/gja/Mail/
[...blah.. copied my email archive to ~/Mail/...]
gja@gjabkup2.space4me.com :

Now I can run packf on the nmh folders under ~/Mail/personal to create a number of mbox equivalents. The following example takes the MH folder (mailbox) personal/usa and converts it into a single file personal_usa_mh_mbox

gja@gjabkup2.space4me.com :cd /home/gja/private/email97/
gja@gjabkup2.space4me.com :packf +personal/usa -mbox -file personal_usa_mh_mbox
Create file "/home/gja/private/email97/personal_usa_mh_mbox"? yes
gja@gjabkup2.space4me.com :

My local Thunderbird profile is at ~/.thunderbird/8fcun664.default/Mail/pop3.ureach.com/ and I’ve created a Thunderbird folder called mh-mail-pre97 in which to store my converted mailboxes. Copy the new mbox file into the target folder:

gja@gjabkup2.space4me.com :cp personal_usa_mh_mbox ~/.thunderbird/8fcun664.default/Mail/pop3.ureach.com/mh-mail-pre97.sbd/
gja@gjabkup2.space4me.com :

Fired up Thunderbird, and voila! The newly created mbox version of my old mh folder is properly recognised by Thunderbird as a new email folder.

Remove the temporary mh mailboxes

After doing the conversions, the NMH mail directory under /home/gja is no longer required so I removed it.

gja@gjabkup2.space4me.com :rm -rf ~/Mail/
gja@gjabkup2.space4me.com :
Advertisements

One comment

  1. This was useful, thank you. As claws seems to be permanently tied to webkitgtk for html rendering I needed to change client but had been putting this off for ages because I remember the last time I changed client and the grinding tedium of broken/inadequate/non-existent import/export/convert tools, and the mind bending documentation of what did exist. Your article brought some clarity to the mysteries of nmh and packf and I got the job done nicely with find, bash pattern matching, while and so on. Goodbye claws!

    Thanks.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: