Make Seamonkey import EML files.
Let me preface this with a disclaimer that this tip has not been tested in Thunderbird. I use Seamonkey, which is based on Thunderbird. So, I assume the trick works in Thurnderbird too.
In several previous versions of Seamonkey, you could open an EML file in Seamonkey mail client (not the browser) from the menu – File » Open file… and then copy the message to one of your mail folders.
In recent versions, those options are disabled. So, the alternative available to me was to open these files in Outlook Express (in Windoze of course) and then copy them to a mail folder, convert its DBX file to MBox format using DBXConv command line utility. Then, I would have drop those Mbox files in a Seamonkey mail store directory. After that, I would be able to access the exported messages in the mail folder with the same name as the Mbox file.
I did a web search and found a link in Ubuntu Forums about a possible solution that requires Ruby. I don’t use Ruby and have no intention of installing it.
MBox is a very popular format and goes back to the early Unix days. So, Seamonkey, Thunderbird, Opera, and countless Unix/Linux-based email clients use the format. I checked the specification for Mbox and found that there is none. The RFC 4155 states that:
The mbox database format is not documented in an authoritative specification, but instead exists as a well-known output format that is anecdotally documented, or which is only authoritatively documented for a specific platform or tool.
Reading further, I learned that the mbox file uses a blank line and a “From” header between the contents of the EML files.
For those who did not know, EML files are just plain text files. Even embedded images and file attachments have been converted to base64 encoding and made part of a plain text file with the EML extension along with mail bodies.
Steps To Convert EML To MBox
Suppose you have a few EML files with you, how do you go from there?
- Open a text editor, create a new file and give it a name. There is no need need to give an extension. Use mbox if you want to.
- Paste the following line
From - Thu Sep 5 08:43:40 2013
Replace the values to the current date or something available in one of the e-mails. It does not really matter. You could simply leave it at that.
- Open one of the EML files and copy all the content.
- Switch to the MBox file and paste the contents. Note that there is no empty line after the “From blah blah” line mentioned above and the contents that you have pasted.
- After the pasting the contents of the first EML file, press Enter to create an empty line.
- Paste the following line:
From - Thu Sep 5 08:43:40 2013
- Open another EML file, copy its contents, and paste it in the MBox file.
- Repeat the same process for the remaining EML files.
- After the last file, leave an empty line. No need for the “From” header.
- Save the Mbox file and copy it to a Seamonkey/Thunderbird mail store folder.
- Open Seamonkey and find a new mail folder that Seamonkey/Thunderbird had created with the same name as the Mbox file. There you will find the converted messages from the EML files.
- Copy the messages to some other mail folder and delete the new folder, as you do not need anymore.
Please note that, on Windows, Thunderbird and Seamonkey can import messages from Outlook Express and other e-mail clients. I am on Linux and use Windows only in a VM.
Bash Script To Convert EML to Mbox
I wrote a script to make the conversion easy.
rm converted_EMLs.mbox for sFile in "$@" do echo "From - Mon Jan 01 00:00:00 2001" >> converted_EMLs.mbox echo "Appending [$sFile]" cat "$sFile" >> converted_EMLs.mbox done echo "Finished"
I copy all the EML files to a directory and then add this script (I use the name eml2mbox.txt) to that directory. I then open the Terminal, CD to this directory and execute the following command:
sh eml2mbox.txt *.eml
How do you end up with .EML files in the first place?
When people using Outlook Express forward message, the message may be sent as an EML attachment. Sometimes, the recipient’s mail client or web service may not recognize EML files.
Sometimes, your mail client may not download a message properly from a POP or IMAP-enabled webmail account. The message may be stuck in the inbox on the Web but may not be available in the mail client locally. In that case, you copy the original source of that message (you need to hunt a bit in the webmail options for the message source) and paste it to in a text file. You give the file an extension eml and then open it in SeamonkeyThunderbird mail client.
As mentioned earlier, Seamonkey mail client opens these EML files just like an e-mail message but will not allow you to copy it to an existing mail folder. That’s the problem and this is how you solve it.