About
This project was originally intended to be just a migration tool,
but I changed it into an archiving and migration tool. What this means is that
you can move messeages from one IMAP server to another, and in addition, you can
choose between moving all messages, or just messages older than X weeks old.
History
I originally wrote a simplified version of this tool for my job. I was asked to
migrate our mail from a linux machine running sendmail to an exchange server (
I had no part in this =). The migration tool that came with exchange was a
complete flop. So I took 3 hours to write and test my PHP script which
migrated the mail over to our new exchange box. Since then I decided to add a
bunch of features to it and open sourced it so others who ran into the same
problem could benefit.
Instructions
Instructions on how to install, setup, configure, and use the IMT
are available here.
Features
Users can migrate / archive e-mail from one IMAP server to another.
Users can specify to move only messages older than X weeks old or
migrate all messages.
Users can specify a different date for their INBOX and the rest of their
suscribed IMAP folders.
Really easy and totally customizable user interface (simple HTML form).
Users can choose to either delete messages from the source server
or leave the messages on the source server.
(Thanks Guy Megouri Cohen)
Flag settings are preserved when messages are either archived or migrated.
For example, if a message was marked as Seen or Answered, they will be marked as such
after it was moved/copied.
Currently, all requests to migrate messages over get written
out to a shell script which can either be run by hand or by a cron job at a
later time. The reason I worked it this way was because people who have an
excess amount of mail (say 1 Gig for example) can cause the web server process to
time out according to the set_time_limit() or max_execution_time value set in the php.ini file on the server. As a shell script, the process can run as long as it needs to.
TODO
Bug Fixes:
Rewrite archivesetup.php to no longer assume register_globals=On since PHP defaults to Off now. (Thanks Andrew Glen-Young for the patch)
Add "notls" to the connection string passed to imap_open() in archivesetup.php and archive.php. Some people reported problems connecting to their IMAP server if "notls" was missing. (Thanks Martin Pirklbauer)
(Note to self: this seems to be a Red Hat bug. Test with hcho).
archive.php script does not work for Courier-imap servers because of the different is syntax such as folder separators (they use '.' instead of '/'). (Thanks Jay Wineinger)
If src_server has messages IN a parent folder, dest_server maybe not support this feature, so those messages should have their mail put in a special subfolder (Look to imap_getmailboxes() and RFC 2060).
New Features:
Add feature to write out windows batch file if web server is on WinOS.
Encode the passwords stored in the shell script and decode them at run time.
Make a step 2 in the web interface that would let you configure settings on individual folders (migrate or not, number of weeks - can default to values set in main page).
Make an admin login with nice features such as importing a username/password list, ability to click on someone's username and change their settings, and ability to configure the folder skip list. (Maybe a run now button).
Add a choice to the user to either just run the migration NOW,
or save it out to a shell script to be run later. This will be easily
configurable via the simple HTML form. This way the administrator can either
force which method the end use must use, or can leave it up to the end user.
NOTE - Once this feature is in place and you choose to have the script run right when the user submits the request, you can always just set max_execution_time = 0 in the php.ini to insure the script has enough time for the migration to complete.