Cheap VPS & Xen Server


Residential Proxy Network - Hourly & Monthly Packages

Converting All Your MS Outlook PST Files To Maildir Format


One of the challenges you may face when converting an office from Microsoft Windows to Linux is that many people archive their e-mail in PST files. There are PST tools available, but most of them are commercial, since the PST file format is closed and protected by Microsoft. There are several non-commercial methods to achieve roughly the same goal, and in this tutorial we use IMAP (more specifically, courier-imap) to convert all our e-mails from PST to the Maildir format. The advantage of this approach is that you also lay the foundation for a new mail system, with all your old e-mails already imported the day you switch over.

One of the challenges you may face when converting an office from Microsoft Windows to Linux is that many people archive their e-mail in PST files. There are PST tools available, but most of them are commercial, since the PST file format is closed and protected by Microsoft. There are several non-commercial methods to achieve roughly the same goal, and in this tutorial we use IMAP (more specifically, courier-imap) to convert all our e-mails from PST to the Maildir format. The advantage of this approach is that you also lay the foundation for a new mail system, with all your old e-mails already imported the day you switch over.

33c1b9fe343fcdd2147f555b1eedbde8-2248

In this tutorial we do not use web interfaces, so it is safe to select “No” here.

Now you need to choose a directory where your mail will live:

$ sudo mkdir -p /opt/imap-mail

Now we need to define our users in the courier-imap user database. There are several ways to do this, including mass conversion of all your users in /etc/passwd using the pw2userdb tool as mentioned in the courier FAQ. Here is what we do to create a single user:

$ sudo touch /etc/courier/userdb
$ sudo chmod 600 /etc/courier/userdb
$ sudo userdb peanut set uid=1000 gid=1000 shell=/bin/bash home=/opt/imap-mail/peanut

In this file, you will have something like the following:

peanut	uid=1000|shell=/bin/bash|home=/opt/imap-mail/peanut|gid=1000

Now you need to set the users password and create the directory that will store all our e-mail:

$ sudo userdbpw -md5 | sudo userdb peanut set systempw
$ sudo mkdir -p /opt/imap-mail/peanut
$ sudo maildirmake /opt/imap-mail/peanut/Maildir
$ sudo chown -R 1000:1000 /opt/imap-mail/peanut

Your /etc/courier/userdb file should now look like this:

peanut    systempw=$1$JdvxSL9/$2TOrNidtALpODg1HZR4Aj1|uid=1000|shell=/bin/bash|home=/opt/imap-mail/peanut|gid=1000

Note : The password field might look different.

In the /etc/courier/authdaemonrc file, make sure you set the following value:

authmodulelist="authuserdb"

Note that you may need to replace the existing authmodulelist value. Now prepare the user DB and restart the entire system:

$ sudo makeuserdb
$ sudo /etc/init.d/courier-authdaemon stop
$ sudo /etc/init.d/courier-imap stop
$ sudo /etc/init.d/courier-authdaemon start
$ sudo /etc/init.d/courier-imap start

The IMAP system is now ready. Next we need to connect MS Outlook to our new IMAP system.

Connect MS Outlook to the IMAP Server

The following process is relatively easy using the MS Outlook client.

Make sure MS Outlook is running, and then click on the “Tools” menu option and select “E-mail accounts”:

c0bb2c19e3fbd885b8c126da013d4b9f-2249

Make sure the following option is selected: “Add a new e-mail account”

91a405ff065d7b31ce81aee6069539e4-2250

On the next screen select the IMAP option:

a5bbca55dabc5c802d3114ad81ac4143-2258

Make sure you complete the relevant details on the next screen:

3b8a327db471493097c2a70f9ef13d4d-2259

When you finish, you can access your new mail box. It should be empty:

1234ccaec5c3175e227126ecbe8c9948-2260

Move mail from your PST files to your IMAP folders

Since you may have various PST files, you could create several folders (or directories) on your IMAP account, and move your e-mail into these folders. Here is how to easily create a folder and move your e-mail into it. First, make sure the “Inbox” folder on your IMAP connection is selected and right click to select the “New folder…” option:

8e35ca475bb9149934f53377af1e37a1-2261

Next you pick a name for your new folder:

1fd0b03b4eb7232091e6c58809f1d39d-2262

And you are now ready to put some mail into the new folder:

5a9f42eb1edd89dae8479d7e8becb19a-2263

Finally, you now need to move your e-mail to the new folder. Go to one of your PST folders, and select all the e-mail. Then right click on the selected e-mail and select “Move to folder…”:

4882d23557244122866479e1311d1d05-2264

Select your newly created IMAP folder from the list and click the “Ok” button:

96c7c96dff7ed144f3a70591fc2f0fed-2265

That’s it – your done!

In your IMAP folders on the Linux server, you should now be able to list your e-mail files:

$ ls /opt/imap-mail/peanut/Maildir/.Old_Mail/cur/

1180237973.M497239P8678V0000000000000801I0037C569_0.peanut-desktop,S=8866:2,S
1180237973.M812137P8678V0000000000000801I0037C56A_1.peanut-desktop,S=6129:2,S
1180237973.M883276P8678V0000000000000801I0037C56C_2.peanut-desktop,S=6981:2,S
.
.
.

Configuring your new mail Linux mail client (KMail) to access your IMAP folders

Finally you need to configure your new Linux e-mail client to access your IMAP folders. I use KMail here as an example, but you could really use any client that support IMAP.

When you start KMail for the first time, you will need to create an account:

ac248f761f4451314ceec80dd123a503-2266

You need to select the IMAP account type:

83b78ee83185ed3d755a977d8755dc7f-2268

And you need to complete your details:

f0e2f7ed9118be3f4d92c1b8b626e40d-2269

And now you enter your log on credentials:

818908db4184d5dc9bff296a71a65ff7-2270

Now enter the IMAP server details:

e06c145378d449310ada0c4a61e5bcd4-2271

We now have all the required information to connect to our IMAP folders. When KMail start, you may not immediately see your IMAP folder. In the account set-up, ensure that the mail client retrieves the mail from the server at start-up:

20c848529f993d1fdc662c3e7aa779d4-2272

And finally, we have access to our converted folder(s):

3d5218f7adda644dbf5d628538af6c88-2273

Final notes on e-mail clients and IMAP folders : In many cases you will need to “subscribe” to online folders. You will notice in the KMail example above I only subscribed to ONE of the folders I created. Similar concepts exists in most mail clients.

Conclusion and References

Hopefully this high level HOWTO could lay the foundation for a MS Exchange migration strategy for individuals and businesses wishing to move away from MS Outlook. There are commercial PST conversion tools available, but using IMAP has the added advantage that you can already integrate into your new mail environment. On the SMTP back-end, it’s simply a question of replacing the Exchange SMTP component with a Linux based SMTP server, which would then start to populate your IMAP folders. In theory, your desktop users would then have a seamless migration from MS Exchange.

So many of you might be asking where to from here. Well, here are some pointers (all links open in a new window/tab):

  • More articles on Kreationnext regarding ‘courier’, ‘postfix’ and ‘imap’
  • The same as above, but from Google
  • The courier MTA home page
  • The postfix home page
  • The IMAP protocol

I hope you can find these resources helpful in your IMAP implementation – especially if you are migrating from MS Exchange.

 

 

 

 

Comments

comments