I'm a hacker, a free software advocate, and a student.
Yesterday, I was at my dad's office. He recently migrated some of his office PCs to Linux. One of the big problems encountered after transition to Linux is migration of e-mails from his previous e-mail client Microsoft Outlook Express 6 (on Microsoft Windows). I'm already using Evolution since November' 2005 (since I got an internet connection at my place :-D). I've heard of Outport for export of mails from Microsoft Outlook Express. So, I downloaded and installed it on his Windows OS. And then started it but it terminated with an error saying Microsoft Outlook is not installed. Oops, but we're not using Microsoft Outlook. So, all the hope of exporting mail from Outlook Express was lost till I got an idea
The idea to export a folder was to select all mails in any folder, and then using DnD feature provided by Windows (drag-and-drop), drag them to a Explorer window and drop them (a CommonDialog will work too but I've not tried that). This will copy all mails in as .EML files in the current directory in Explorer window. The good thing about these .EML files are they're plain text files representing a mail in MIME format which
mbox file uses.
mbox file looks like below. When
mbox is passed to file utility for recognition it recognizes as
ASCII mail text, with very long lines. Whenever a new mail arrives it is appended to
mbox with a starting line similar to
From email@example.com Tue Jul 31 13:21:11 2008. This line is not part of MIME specification.
From firstname.lastname@example.org Tue Sep 25 07:45:12 2001 Return-Path: <email@example.com> Received: from pop.novell.com (IDENT:mail@localhost [127.0.0.1]) by pop.novell.com (8.9.3/8.9.3) with ESMTP id HAA20680; Tue, 25 Sep 2001 07:45:12 -0400 Received: from smtp.novell.com (smtp.novell.com [184.108.40.206]) by pop.novell.com (8.9.3/8.9.3) with ESMTP id HAA20659 for <firstname.lastname@example.org>; Tue, 25 Sep 2001 07:45:10 -0400 Received: (qmail 5610 invoked from network); 25 Sep 2001 11:45:02 -0000 Received: from smtp.novell.com (HELO localhost) (220.127.116.11) by pop.novell.com with SMTP; 25 Sep 2001 11:45:02 -0000 From: "The Evolution Team" <email@example.com< To: Evolution Users <firstname.lastname@example.org> Content-Type: multipart/related; type="multipart/alternative"; boundary="=-t4dRE6cqcdSBHOrMdTQ1" X-Mailer: Evolution/1.1.99 (Preview Release) Date: 7 September 2005 14:45:00 +0300 Message-Id: <1001418302.27070.20.camel@spectrolite> Mime-Version: 1.0 Subject: Welcome to Evolution! Sender: email@example.com Errors-To: firstname.lastname@example.org .... ....
So, now you know where to hack. ;-). Just wrote a simple shell script (or an operating system driver ;-) ) that concatenates each file and delimits them with the line similar to
From email@example.com Tue Jul 31 12:40:33 2008. Most of the mail programs doesn't consider this line to be meaningful (I think so) and consider it as a mail delimiter. So a fake line need resembling above needs to added before each mail entry. The from address and date are instead extracted from
Date: MIME headers. So basic pseudocode is
I'm not providing any shell script to do this job for you. Since one of the major pillars in GNU/Linux is Software Toolbox philosphy. And if you're learning these utilities, this might be a good project for you. If you're lucky enough somebody might have posted the script as comment in my blog. ;-)
There are some of my webpages tooo...