[Dovecot] Importing emails from PST Archives

Andre Rodier andre.rodier at gmail.com
Wed Mar 27 00:48:58 EET 2013

Hello everyone,

I am currently migrating a small company from exchange 2003 to Dovecot.

So far, the most painful process has been the PST archives. (Except the inconditionals of Outlook)

I have been able to create the directory structure using the last version of readpst, with the -r flag.
But once this done, I have not been able to find one tool that worked correctly.
Maybe the configuration I have is complex.

The perl script to transform mbox files into maildirs in the dovecot distribution is old, and crashed many times in the middle of the process.
I had a look to the script, and gave up trying to fix it.

I found a python script that was supposed to crawl this folder structure, and to replicate it using IMAP commands, but it crashed as well, and restarting the
process would import twice the same messages. The script is here:

I found another python script that was working better, and seemed to be well written, but with one mbox to one IMAP folder only.
It can be found here: http://imap-upload.svn.sourceforge.net/viewvc/imap-upload/trunk/
I have modified, and I have added some minor fixes:
- Recursively traverse a folder structure, and replicate it using IMAP commands on the server.
- Properly manage folder names with special characters. (dovecot can manage these characters using the listescape plugin).
- Avoid taking all the resources of the server (A quirty hack that can change).

I am not an expert in Python, and the script has been quickly writter to fit my needs. However I think it can be modified easily to any configuration.
In the future, maybe this script can use the libpst python bindings to import the emails directly.
The last version of the script, modified is here: https://github.com/arodier/EmailTools/tree/master/Migration. Do not hesitate to help me, to make the script as
generic as possible, particularly if you are a python expert.

I post this on this list, because I think you maybe interested if you are in the same case as me. The license is not specified, but I will probably use GPLv3.


More information about the dovecot mailing list