IMail Migration README
----------------------

This document outlines the procedure for migrating your users and their email from the IMail email
system into Atmail 6.x.x.

1. Scripts Used

The following scripts are used to complete an IMail > Atmail 6 migration:

/usr/local/atmail/webmail/utilities/migration/imail/migrate-imail.pl
/usr/local/atmail/webmail/utilities/migration/imail/import-users.php   
/usr/local/atmail/webmail/utilities/migration/imail/migrate-abook.php
/usr/local/atmail/webmail/utilities/migration/imail/migrate-msgs.php

2. Procedure

    1. Copy /usr/local/atmail/webmail/utilities/migration/imail/migrate-imail.pl to the IMail server
    2. If you don't have Perl installed on the IMail server you will need to install it now
    3. From the Windows command line move to the directory containing migrate-imail.pl and
       execute the following commands:
       
       > perl migrate-imail.pl -users
       > perl migrate-imail.pl -useraliases
       > perl migrate-imail.pl -hostaliases
       
       NOTE: You may need to type the full path to the "perl" binary.
       
       Once these commands have completed you should have the following three files in the current
       working directory:
       
       users.txt
       useraliases.txt
       hostaliases.txt
       
    4. Copy the three files above to the Atmail server. For this example we will presume the files
       are copied to /tmp/imail-data/ on the Atmail server.
    5. Move to the imail scripts directory on the Atmail server:
    
        # cd /usr/local/atmail/webmail/utilities/migration/imail
        
    6. Execute the following command which will migrate IMail users, user aliases and host aliases 
       into Atmail:
       
        # php import-users.php /tmp/imail-data/ admin
        
        (usage: php import-users.php [path to imail data] [atmail admin username])
        
        Once this script has completed all IMail users, user aliases and host aliases should now
        exist on the Atmail system.
        
    7. Now take a copy of all the email on the IMail system and move it onto the Atmail system.
       Again we will presume the location it's moved to is /tmp/imail-data/ on the Atmail server.
       You will want to shutdown the IMail server while this is done, so that no new emails
       arrive on the IMail system.
       
    8. Now move back to the Atmail server. We now need to make sure the email dump is in the
       correct format. When the email archive is extracted it should have a directory for each
       domain the system hosted. e.g.:
       
       /tmp/imail-data/domain-one.com
       /tmp/imail-data/domain-two.com
       and so on...
       
       If the names of the directories are not the proper domain names you will need to rename
       them. For example if we have "/etc/imail-data/domain-two" for the domain-two.com users
       then rename it to "/etc/imail-data/domain-two.com". Basically each directory that contains the
       users for each domain should be named using the full domain name.
       
    9. Once we have all the directories with correct names matching the domains whos data they
       contain we can start the email migration process. Run the following script:
       
       # php migrate-msgs.php /tmp/imail-data/ admin
       
       This script will recursively transverse the directory given in the first argument and
       search for directories containing IMail email data. Each time it finds one it will add the
       domain name into the Atmail system (using the name of the parent directory, hence the need
       for it to have the same name as the domain). It will then process all the email data for each user,
       transfering it from the mbox format into each users corresponding MailDir. The script will
       create any new mail folders it needs to for each user as it goes.
       
       Some folders will be renamed:
       
        Main.mbx will become Inbox
        Draft.mbx will become Drafts
        Deleted.mbx will become Trash
        
    10. All email should now be imported. You could now switch MX records to the Atmail server so
        that your users now start to receive their mail once again. Make sure the Atmail server is
        running:
        
        # /etc/init.d/atmailserver restart
        
    11. Now to import your users' address book data:
    
        # php migrate-abook.php /tmp/imail-data admin
        
        The script will recurse through all subdirecties of the given path looking for address book 
        data for each user. Once found it will import each user's addressbook data into their Atmail
        address book.
        
    12. Sit back, have a beer and enjoy your new Atmail6 server!
