On occasion, system administrators may need to move a domain from one SmarterMail server to another. For example, there's a domain that is using an inordinate amount of disk space, so it needs to be moved to a SmarterMail server that has a lot of free disk space available.
Using Attach / Detach
The simplest way to move a domain, and one that does NOT entail stopping the SmarterMail service (thereby stopping email for all domains on the server) is to use Detach / Attach. NOTE: if you attempt to Detach a domain that is on an older version of SmarterMail -- one that still has XML files, for example, rather than one that has been converted to JSON -- this will fail. You will need to follow the steps outlined in Manually Moving a Domain.
To use Detach / Reattach, do the following (NOTE: You do NOT need to stop the mail service on either server when detaching/attaching domains):
- Log in as the System Administrator.
- Navigate to Manage -> Domains.
- Select the domain you want to move.
- Select Detach Domain, either from the Actions (⋮) menu or by right clicking the domain name and selecting it from the context menu.
- Go to the Domains folder in your SmarterMail installation (Windows Default: C:\Smartermail\Domains | Linux Default: /var/lib/smartermail/Domains).
- Copy the folder of the domain you want to move. If moving the domain to a non-networked server, you will want to copy the folder to an external drive.
- Once the domain's folder is copied to the new server, you'll want to log in to SmarterMail on that server as the System Administrator.
- Again, navigate to Manage -> Domains.
- Select Attach Domain from the Actions (⋮) menu.
- Type in the path to the new domain folder you moved over. By default, this will be DomainPath\DomainName.
- Click the Attach button.
- Finally, retrieve the domain's SSL certificates from the old Certificates directory, and move them to the destination server's Certificates directory (Windows Default: C:\Smartermail\Certificates | Linux Default: /var/lib/smartermail/Certificates).
It's worth noting that all users, settings, notes, calendars, tasks, etc. are all moved when you use Detach / Attach. The only thing impacted is domain aliases. Those will need to be re-created once the domain is moved.
Manually Moving a Domain
Follow these steps to manually move a SmarterMail domain to another server. NOTE: These are the instructions to use if you're on an older version of SmarterMail that still uses XML files:
- Before beginning, make a backup copy of the domains.json file (Windows Default: C:\Program Files (x86)\SmarterTools\SmarterMail\Service\Settings\ | Linux Default: /etc/smartermail/) and the folder for the domain you want to move. So if you were moving example.com to a new SmarterMail server you'd want to make a backup of DomainPath\example.com. (Windows Default: C:\Smartermail\Domains | Linux Default: /var/lib/smartermail/Domains).
- Stop the SmarterMail service on both servers.
- Copy the domain's folder from the old server to the new server. The default install path for the domain folder should match the old server (DomainPath\example.com).
- Using Notepad or a similar text editor, open the domains.json file on the old server.
- Locate the entry for the domain being moved. (E.g., example.com) It will be displayed in one of these two formats:
"example.com": { "data_path": "C:\\Smartermail\\Domains\\example.com" },
// or, for Linux:
"example.com": { "data_path": "/var/lib/smartermail/Domains/example.com" },
- Copy the domain entry from the file and keep it on hand. Then delete the domain entry and save the file. (NOTE: You may need to save it to the desktop, then manually replace the original due to Windows Security.)
- Make a backup of the domains.json file on the new server.
- Using Notepad or similar text editor, open domains.json on the new server.
- Paste the domain entry from the file on the old server, making sure to adhere to the proper naming/formatting of the name.
- Save the file. (NOTE: You may need to save it to the desktop, then manually replace the original due to Windows Security.)
- Start the SmarterMail service on both servers.
- Update the primary MX record for the domain to the new IP. This can take up to 24-48 hours for propagation.
- Finally, retrieve the domain's SSL certificates from the old Certificates directory, and move them to the destination server's Certificates directory. (Windows Default: C:\Smartermail\Certificates | Linux Default: /var/lib/smartermail/Certificates).