weblog d’un abbe

20060326

Outlook Express to mbox conversion

Filed under: Experiments, Hacking — abbe @ 0242

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.

An 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 tycoon@someorganization.tld Tue Jul 31 13:21:11 2008. This line is not part of MIME specification.

From evolution@novell.com Tue Sep 25 07:45:12 2001
Return-Path: <evolution@novell.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 [141.154.95.10]) by
        pop.novell.com (8.9.3/8.9.3) with ESMTP id HAA20659 for
        <evolution@novell.com>; 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) (141.154.95.10) by
        pop.novell.com with SMTP; 25 Sep 2001 11:45:02 -0000
From: "The Evolution Team" <evolution@novell.com<
To: Evolution Users <evolution@novell.com>
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: evolution@novell.com
Errors-To: evolution@novell.com
....
....

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 tycoon@someorganization.tld 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 From: and Date: MIME headers. So basic pseudocode is

  1. Create a empty [mbox file]
  2. Initialize default delimiter [line]
  3. For each [file] in [list of files] do {
  4. Echo [line] to the [mbox file] in append mode1.
  5. Type [file] to the [mbox file] in append mode1.
  6. }

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. ;-)

1HINT: cat abcd.txt >>file_opened_in_append_mode.

Advertisements

2 Comments »

  1. Well, I think you should always have up to date email backups. I used to do it manually by saving the .dbx files, until I found http://www.amicutilities.com/outlook-express-backup/ – Outlook Express Backup Genie that does it automatically at regular times.

    I choused it over other because it can work with both MS Outlook and Outlook Express

    Alicia

    Comment by Alicia — 20060730 @ 2141

  2. as-94783-sa

    Very interesting article

    Comment by Guest — 20060820 @ 2202


RSS feed for comments on this post. TrackBack URI

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

Blog at WordPress.com.

%d bloggers like this: