Migrating from Pegasus to Thunderbird

December 20, 2012

I’ve been on Pegasus Mail for ages. It’s OK, but not open source, and I’ve always had the vague fear that some day my email will be locked away due to a format change. In addition, its HTML handling is not the best, and the way it does multiple accounts is a little weird. Finally, it was getting slow on my Windows XP PC due to the file system – and migrating it from one PC to another is a pain, especially if you’re changing the drive the data lives on.

So I resolved to move to Thunderbird. I started from here:
www.techspot.com/community/topics/how-to-convert-emails-from-pegasus-to-thunderbird-format.17806/

and here:
fixunix.com/mozilla/420484-pegasus-thunderbird-import-problems.html

and when I did the MBox method, it seemed to work fine. Until I looked at the folder on Thunderbird and saw more messages than I’d counted on.

It appears that Thunderbird uses “\n\nFrom .*\n” to filter its messages. Ok, but Pegaus doesn’t quote the From in “From the editor:” which appears at the start of the line in some of my messages. Argh! This left me with lots of messages split in half, with weird dates and strange subjects / from / to lines.

I hacked up the following awk script, which I put in a file called peg2tbird:

/^From / && ! /\?\?\?\@\?\?\?/ { printf ">%s\n", $0 }
!(/^From / && ! /\?\?\?\@\?\?\?/ ) { printf "%s\n", $0 }

This takes any line that matches “From ” but doesn’t match “From ???@???” and puts a > in front of the From. All other lines it leaves as-is.

Then I ran:
\cygwin\bin\gawk -f peg2tbird < unx01234.mbx > tbird-mbox-file

Then I copied tbird-mbox-file to my Thunderbird Profile directory (in Mail\Local Folders).

This makes the messages look a little strange in Thunderbird – they look like “>From the editor:”. Also, some messages ended up showing with today’s date – inserted by Pegasus. (I think it was just those generated by a virus checker, so they were probably less well-formed than real messages.) Sigh. Oh well, that’s good enough for me to get my old messages migrated.

Advertisements