How to convert a .doc into email?
November 26, 2008 1:50 AM   Subscribe

How can I convert a text file into email?

I have a large word (.doc) file that is a compilation of old email. It's 226 pages long and consists of emails with header information. Each looks something like this:

From: IN%"" "A BEAR OF VERY LITTLE BRAIN" 10 JAN 1995 13:17:29.96
To: IN%""
Subj: How do?

Return path:
Received: from by (PMDF V4.3 10 #8854)
id <0>; Tue, 10 Jan 1995 13:17:10 0500 (EST)
Received: from ANGEL by ANGEL (PMDF V4.3 7 #6366)
id <0>; Tue, 10 Jan 1995 13:11:22 EST
Date: Tue, 10 Jan 1995 13:11:22 0500 (EST)
Subject: How do?
Message id: <0>
X Envelope to: samp X VMS To: IN%""
MIME version: 1.0
Content transfer encoding: 7BIT

Hi! How are you? Please write back.


How can I convert this into a file that I can read like my other email in Thunderbird?
posted by underwater to Computers & Internet (7 answers total)
Save it as plain text file, then try to import it into Thunderbird. I haven't used Thunderbird, but on OS X can import mail in that mailbox format.
posted by ignignokt at 2:03 AM on November 26, 2008

You'd need to convert the text document into a format readable by Thunderbird. I think in this case it would be .LDIF

Why do you only have a .doc file? I assume at some point you or someone else copied and pasted these emails into Word? What's happened to the source? If you still have access to that, you could export the emails as a usable file, which would be way simpler.
posted by Happy Dave at 2:04 AM on November 26, 2008

Also, this KB article will help once you have a usable file.
posted by Happy Dave at 2:04 AM on November 26, 2008

Response by poster: Perhaps I should state the question differently. I have these emails only in this .doc format. I know how to import files into Thunderbird but it cannot import in this format. How can I take my current file and convert it to a file format that can be imported by Thunderbird? Thanks.
posted by underwater at 2:35 AM on November 26, 2008

Well, to save it as a text file, you'd do: open in Word (or other word processor), go to File > Save As > select .txt file format from the drop-down menu.

From there I don't know how you get the Thunderbird format, though.
posted by Xany at 2:42 AM on November 26, 2008

Here's a Python script that converts plain text files to mbox format.

Here's how to run that script using 'drag and drop'.

I think, but I'm not sure, you'll need to change the lines in the script that say 'infile' and 'outfile' to the names of your files. So your input file might be 'mybigassemailarchive.txt' and your outfile would be 'mybigassemailarchive.mbox'.

Basically, copy and paste the script into a new text file, save it as '' on your desktop. Change the lines as above. Install Python, if it's not already installed. Drag the script onto the Python Interpreter icon to run it.

And Bob's Your Uncle.
posted by Happy Dave at 2:49 AM on November 26, 2008

Thunderbird uses the mboxrd format. This is close to the format of the message defined.
Mboxrd defines messages as starting with From followed by a single blank space, and ending in a blank line.

Assuming the next message starts immediately after the line at the end (so ther is only one line with each message) you need to:
1. Replace the line with a blank line
2. Convert the first instance of 'From:' to 'From ' (i.e. the line 'From: IN%"" "A BEAR OF VERY LITTLE BRAIN" 10 JAN 1995 13:17:29.96' but not 'From: A BEAR OF VERY LITTLE BRAIN')
There is also a stray IN% and pair of quotes.
You can probably tackle this by doing a search an replace swapping
'From: IN%"AMILLER' for 'From ' then removing the rest of the IN% and quote marks on subsequent passes.

Then save it to a text file and you should be able to import it into Thunderbird.

N.B. The Python script Happy Dave linked does nothing like this. It converts from "foo at" to "" and puts in line feeds. (you might have a problem with line feeds, if you are on Windows thunderbox's version of mboxrd insists on the Unix way, but I would suspect not, in any case that is a different problem we can solve).
posted by tallus at 8:40 AM on November 26, 2008

« Older Sci-fi that they will let her read and that she...   |   Tips for binding my own copies of books in the... Newer »
This thread is closed to new comments.