Migrating

# Migration Details

Migrating to SurgeMail with SurgeMail on same server
Migrating to SurgeMail with SurgeMail on a different server

## Migrating to SurgeMail with SurgeMail on same server.

If you want to migrate to SurgeMail and put SurgeMail on the same machine as your existing server you can still use the migration method by making the old server run on different ports. The below example is for migrating pop accounts accross, but if you wish to migrate imap accounts then just need to use the imap settings instead.

Change old_pophost to old_imaphost
Change old_pophost_nodomain to old_imaphost_nodomain
You can put both imap and pop migration settings in surgemail.ini if you have both imap and pop accounts to be migrated.

Let's say you have oldserver running on ports 25 and 110
You now change old server to run on ports 1025 and 1110

Now you install SurgeMail on the same machine, at this point you setup the domains on SurgeMail so they match your existing domains.

Then you should stop SurgeMail, edit surgemail.ini in /etc on the windows directory.
Now you look for the domain section in surgemail.ini for the domain you want to migrate

>     vdomain address="" name="catch.netwin.co.nz"
>     create_user "email"
>     create_max "3"
>     create_reqd "pass_question,pass_answer"
>     create_repass "TRUE"
>     host_alias "catch.netwin.co.nz"
>     mailbox_path "C:\surgemail\mbox\catch.netwin.co.nz\"
>     quota_default "20mb"
>     redirect was="abuse" to="stu@catch.netwin.co.nz"
>     redirect was="postmaster" to="stu@catch.netwin.co.nz"
>     redirect was="support" to="stu@catch.netwin.co.nz"

So, now we add in our migration settings..

If we are migrating pop we will use the old_pophost setting

>     old_pophost "127.0.0.1:1110"

So that tells SurgeMail to check on that ip and port when a user pops, SurgeMail will then log the user into that old server and collect all their mail and add them to SurgeMail's database.

If your users didn't login as user@domain on the old server and rather just logged in as user then you need to add this setting also

>     old_pophost_nodomain "true"

Now the problem is, that any mail coming into SurgeMail on port 25 for a user that hasn't been migrated will be rejected by SurgeMail as the user doesn't exist, so we need to tell SurgeMail to send that mail to the old server still. This is how we do that.

>     fallback_relay "127.0.0.1:1025"
>     fallback_check "true"

The first setting tells SurgeMail to send any mail for a user that doesn't exist to 127.0.0.1 port 1025
The second setting tells SurgeMail to check the rcpt exists on the old server before sending it there.

That is all!, now you leave SurgeMail in this setup for maybe a month, to give your users time to migrate after that you can remove the migration settings and remove your old server completely.

So the complete vdomain block in surgemail.ini will now look like this.

    vdomain address="" name="catch.netwin.co.nz"

    create_user "email"
    create_max "3"
    create_reqd "pass_question,pass_answer"
    create_repass "TRUE"
    host_alias "catch.netwin.co.nz"
    mailbox_path "C:\surgemail\mbox\catch.netwin.co.nz\"
    quota_default "20mb"
    redirect was="abuse" to="stu@catch.netwin.co.nz"
    redirect was="postmaster" to="stu@catch.netwin.co.nz"
    redirect was="support" to="stu@catch.netwin.co.nz"
    old_pophost "127.0.0.1:1110"
    old_pophost_nodomain "true"
    fallback_relay "127.0.0.1:1025"
    fallback_check "true"

You can check the status page to see how the migration is going (migrated).

USERS
Total: 70
Migrated: 35 this month
New: 10 this month
You can also check the users_yymm.rec in the surgemail directory to see which users have been migrated, the file will contain entries like this.

1092718001 [migrated](test@ally) by (SERVER)

## Migrating to SurgeMail with SurgeMail on a different server.

This is almost the same as the process outlined above, you should read that first then return here.

You simply change the settings to point to the old server again and change the MX records for the domain to point at SurgeMail, you also get your users logging into SurgeMail not the old machine. The one problem that comes into play if you put SurgeMail on a new machine is mail coming in to the old server for a user that has already been migrated due to MX records taking a while to change.

old server has ip 10.0.0.1
SurgeMail is installed on ip 10.0.0.2

User "test" logs into the SurgeMail server and migrates his account, but now a new message comes into 10.0.0.1 for "test", as SurgeMail has already migrated the account, the next time "test" logs in SurgeMail won't check the old server for mail so "test" will lose that message.. or will they?

You have two options here:

- You can use the setting old_pophost_always "true" - This tells SurgeMail to always check on the old server even if the user is already migrated, this means no mail will get lost if its delivered to the old server after the user is migrated. You can leave this setting on for several days, until the DNS's have all propogated throughout the world with the new MX entries that point to the new SurgeMail server.
- You could give the new SurgeMail server the ip of the old server and give the old server a new ip, this means that you don't have to change any MX records at all and you won't need the above setting old_pophost_always which slows the system down, this is the better option if you can do this.

## Intercept migration with name translation

In the event you want to use intercept migration (for account creation - reusing old password - and mail translation) and your account old naming scheme is not directly supported by surgemail, account name translation can be done just prior to surgemail's login to the old server as below. This is particularly useful in the case:

- login names on old system being different from the email address (end users obviously need to change their login from old username to email address)
- Systems with really weird prefix or suffix based names which is currently not directly supported by (old_pophost_sep / old_pophost_nodomain / etc)

To use this, create a file "migration_translation.txt" of 'surgemail login' [space] 'oldserver login' pairs for each account on your old system. This file is only loaded at surgemail startup and is located in surgemail root directory (as specified by g_home).

eg.

    marijn@mydomain.com domain_marijn_suffix
    joe@mydomain.com SomeWeirdUsername