Skip to content

Moving a cPanel account between WHM servers without losing mail or DNS

A cPanel account transfer copies the home directory but routinely drops mail routing and DNS authority. Here is how to move one cleanly between WHM servers.

A WHM-to-WHM transfer using the built-in “Transfer Tool” copies the home directory, the cPanel user, the databases, and the local zone — and then mail starts bouncing twelve hours later, or the DNS for one of the parked domains stops resolving. The transfer itself succeeded. What did not transfer is the routing context that lives outside the account.

What’s happening

A cPanel account is not self-contained. /etc/localdomains, /etc/remotedomains, the /etc/mailips and /etc/mailhelo entries, the cluster’s DNS authority for parked and addon domains, and any IP-based mail reputation all live on the source server. The Transfer Tool moves the account’s files and the zone records, but the receiving WHM has no idea that the source is still answering as authoritative for the domain, and the source has no idea it should now route mail outbound through the destination IP.

How to verify

Before cutover, on the source:

grep "^example.com$" /etc/localdomains /etc/remotedomains
dig +short NS example.com @1.1.1.1
whmapi1 listaccts search=example.com searchtype=domain

On the destination, immediately after the transfer:

grep "^example.com$" /etc/localdomains /etc/remotedomains
/scripts/mailperm example.com
exim -bt postmaster@example.com

If localdomains still lists the domain on the source while the destination also lists it, mail will route to whichever IP DNS points at — and the other server will reject as unknown user. exim -bt on the destination should resolve to a local delivery, not a smarthost.

The fix

  1. On the source, mark the domain remote: edit /etc/localdomains to remove it, add it to /etc/remotedomains, and restart Exim. This tells the source to relay rather than accept mail for the domain.
  2. On the destination, confirm the domain is in /etc/localdomains and not /etc/remotedomains. If a DNS-only zone was created accidentally, re-run /scripts/fixndc and /scripts/dnscluster synczone example.com.
  3. Lower the zone TTLs to 300 seconds at least 24 hours before cutover. Update the NS records to the destination cluster only after the destination is serving the zone correctly via dig @destination-ip example.com SOA.
  4. Re-issue mail certificates on the destination via AutoSSL once mail.example.com resolves to the new IP — old certs reference the old IP’s hostname.

Cluster the DNS between source and destination during the migration window so the zone is authoritative on both until the NS swap completes.

This is the kind of cutover we own end-to-end inside the Deployment Management engagement — book a migration review if a transfer is upcoming.