How to Convert Outlook PST to Thunderbird
During a recent disagreement between Windows 7 64-bit and my internal hard drive, I made a change. First, Windows 7 lost and the hard drive kept its life.
The change I made was to once again go down the road of running Linux as my primary operating system. This time it was Ubuntu 11.04 64-bit. However this article is not about the operating system, it is about the process I used to get my backed up local .PST files created by Microsoft Outlook to give up those precious emails so I could refer to them in my new email client, Mozilla Thunderbird.
There are plenty of articles you can Google that talk about the best process to make this happen. It tends to be along the lines of installing Thunderbird on a Windows machine that also has Microsoft Outlook installed along with your .pst files. In this setup, you can supposedly use the built-in Thunderbird import feature which makes calls to Outlook to get at your emails. In my case, I didn’t want to have to try and go through that time consuming process.
Instead I ended up using a Linux package to extract the emails, renamed all the files and imported them all using a Thunderbird plugin. So, let’s get to the details.
Step 1 – Get your email out of the .pst files.
Install the readpst package.
1 sudo apt-get install readpst
Now create the directory where you will want the extract email files to be placed.
1 mkdir pst-export
Next execute the readpst command against a .pst file.
1 readpst -D -M -b -o pst-export archive.pst
UPDATE: Ian Major commented on a simpler solution. “Works great, after reviewing the options for readpst I changed the command line to be ‘readpst -M -b -e -o pst-export archive.pst’ which doesn’t import deleted messages, and outputs with the eml extension, which means the rename isn’t required.”
Step 2 – Rename exported files
The readpst command will export all your emails into a folder hierarchy that matches the previous folder hierarchy in Outlook. The only problem is that every email is exported as a numeric filename. The text document are .eml files but don’t have the .eml extension. Therefore, we need to recursively rename all the email files to add the .eml extension. Lots of other articles will have you create bash, python, perl or other scripts to do this. I actually found the easiest to be a single command line.
1 find . -type f ! -iname '*.eml' -exec rename 's/([0-9]+)$/$1.eml/' {} \;
NOTE: Depending on how many emails you have to rename, this is not the fastest approach and may run quite a while.
Step 3 – Import .eml files into Thunderbird
It’s now time to import all those email files into Thunderbird to make them useful. I found that what worked best for me was to install the ImportExportTools plugin for Thunderbird and use it to bring everything in.
Once you have installed the plugin it is time to use the tool. Inside Thunderbird, create a temporary local folder that we will use to house this mass of emails that you can later do what you please to get them where you want for their final location in Thunderbird.
Right click the folder in Thunderbird and choose the following menu path
import/export –> import all eml files from a directory –> also from its subdirectories
Then choose the folder you exported all the .pst emails tools (pst-export). Now sit back and wait while all your lovely emails you missed so much are made an active part of your new Thunderbird installation. Go get another cup of coffee and maybe a snack as this too will take a little bit to complete and you’re done.
Brian on said:
Bookmarked, I love your blog!
Lalatendu on said:
Thanks
you made my day
Justin on said:
Helpful Thanks brother
Erik on said:
you’re great!! Thanks a lot. A perfect documentation of what to do and when to do! Never read such a good, short and still working ‘manual’
Bass on said:
Very helpful.
Thank you!!
Charles on said:
Very useful. I tried a lot tools/solutions. Yours is the the best. Thanks
Matti Viljanen on said:
I was, again, looking for the answer too far. Thanks!
Dhaval Kolhapure on said:
Thanks you, Man. This post helped me a lot. Nice Blog. I am fan.
Dhaval Kolhapure on said:
Suggestion:
The suggested Command:
______________________________
find . -type f ! -iname ‘*.eml’ -exec rename ‘s/([0-9]+)$/$1.eml/’ {} \;
______________________________
changed all the “non extension” files, mp3 files and mp4 files into eml files.
To get restore them back I had to cut-paste the pst-export folder to a flash drive, detach the flash drive from the system, find all the eml files by running a .eml search, then install and run a extension renaming GUI software, KRename, to get back the mp3 and mp4 files, and then paste back the pst-export folder to Home Directory.
It was worth the time and effort; however, I was wondering it were possible to find all the files that do not have an eml extension only in the pst-export folder and then renaming (giving an eml extension) those files?
Anuj Singh on said:
Love this blog…
It helped me a lot to get my mails back.
Tom on said:
Glad it helped a few more folks than just me.
Blessings to you.
Daniel on said:
Thanks for this, I’m glad I don’t have to use the Windows technique. But like Dhaval says, I would change that command line argument to target the pst-export directory. People are just going to run it without knowing what it does and it’s going to change all their non-extension files in their home directory. Thanks again for the guide.
roberto on said:
worked perfectly, thanks a lot!
roberto
Ian Major on said:
Works great, after reviewing the options for readpst I changed the command line to be ‘readpst -M -b -e -o pst-export archive.pst’ which doesn’t import deleted messages, and outputs with the eml extension, which means the rename isn’t required.
Bernhard on said:
I’m a ubuntu-rookie and will say: thx a lot
I’m astonished. It works fine
Bernhard from Germany
altamira01 on said:
Good article. thanks so much.
I tried with my personal folder and it worked well. But when I Tried with my Exchange account (local folder) it didn’t work, import/export option only created me the folder but didn’t import the emails.
any suggestion?
altamira01 on said:
Here again, I repeat the process and now all is working very good!!
thanks!
Till on said:
Brilliant! You really rescued me. Thank you so much!
All the other ways described in various threads just did not work or they had some serious trade-offs.
However something that may be obvious to an experienced user, but that initially threw me off as a complete linux-novice were 2 details which you did not mention:
Given your syntax described above…
1. the pst-export directory has to be created inside the directory that contains all the *.pst-files for exporting.
2. Inside the Terminal one has to change the path to the same directory as the one that contains the *.pst-files before executing the readpst-package (enter ‘cd ` in the terminal). This is just for information for the other novices out there…
Tom on said:
Only suggestion I can offer at the moment is to bring you Exchange emails into a local .pst then go from there. Alternatively, move the Exchange emails from local to the server and then connect Thunderbird via IMAP and do as you please from there.
nicolas cely guayara on said:
thankyou, excellents instructions, solve mi problem
Jaidev on said:
Too good, this is what I was looking for, worked for me.
Ashis on said:
Hi Tom,
I am a beginner & I tried with the above method.
I am getting error in last step of Step 1 : readpst -M -b -e -o pst-export archive.pst..
It says No file or directory exists.
Can you please help.
I have copied the orginal archive.pst file to the created pst-export folder.
Please help.
Thanks
Tom on said:
Ashis,
The error is telling you that archive.pst or pst-export does not exist in the current working directory (the one you are in now).
Be sure that you are running this command while in the directory that has your archive.pst file and contains the pst-export directory. If the path to the pst-export directory or archive.pst is different than the current directory, you’ll need to include the full path in the command line.
Hope that helps.
Tom
Clayton on said:
Absolutely superb ! I’m a linux newbie and your solution was by far the best one !
Worked first time.
Many thanks,
Clayton