How to move a website to new hosting without your email going down
A site and its email are separate DNS records. Which ones to change, which to leave alone, and what to check so not a single message goes missing.
Published: Updated: 8 min read Asen Panayotov, B63
Short answer: you can move a website without touching your email, because the site and the mail use separate DNS records. Change only the A or CNAME record for the site and leave the MX, SPF, DKIM and DMARC records alone. First check that the MX record doesn’t point at the domain itself and that SPF doesn’t rely on +a.
A domain’s website and its email are separate records in DNS, and they move separately. When you move the site you change only the record pointing at the web server; the mail records stay exactly as they are. Problems almost never come from the move itself — they come from two details that sit unnoticed for years: the MX record pointing at the domain itself instead of at a mail server, and an SPF record that relies on +a. Both work flawlessly while the domain points at the old host, and both break the moment you repoint it.
Why email goes down at all
DNS is the domain’s directory. It holds separate lines for different services:
- an A or CNAME record for the site itself — “when someone opens tcp.bg, send them to this server”;
- an MX record for mail — “messages for @tcp.bg are delivered to this server”;
- TXT records (SPF, DKIM, DMARC) that prove messages from the domain are genuine;
- records for webmail, cPanel, FTP and other supporting services.
Moving the site touches only the first line. Email keeps working because the MX record points somewhere else. That is the theory, and most of the time it holds.
The two cases where it doesn’t are common on older hosting accounts:
The MX record points at the domain itself. Instead of mail.yourdomain.com, it simply says yourdomain.com. While the domain points at the old server, which also hosts the mail, everything is fine. The second you repoint the domain to the new site, sending servers start delivering messages to your new web server — which does not accept mail.
The SPF record uses +a. That means “allow whatever server the domain points to”. After the move that server is a different machine, so SPF starts authorising the wrong one while the real mail server is left unauthorised. Your outgoing mail begins landing in spam folders.
What do the email records actually look like?
It helps to know what you are looking at when you open the DNS zone. Here is a worked example for a domain, example.com, whose email runs on Google Workspace while the website moves to a new server at 203.0.113.10:
| Type | Name | Value | Touch it during the move? |
|---|---|---|---|
| A | example.com |
203.0.113.10 (the new web server) |
Yes, this is the move |
| CNAME or A | www |
example.com or the same IP |
Yes |
| MX | example.com |
smtp.google.com, priority 1 |
No |
| TXT (SPF) | example.com |
v=spf1 include:_spf.google.com ~all |
No |
| TXT (DKIM) | google._domainkey |
v=DKIM1; k=rsa; p=… (a long key) |
No |
| TXT (DMARC) | _dmarc |
v=DMARC1; p=none; rua=mailto:dmarc@example.com |
No |
The values come from Google’s own setup guides for MX records and SPF. On Microsoft 365 the pattern is the same but the values differ: the MX points at the address shown in your Microsoft 365 admin centre, SPF typically reads v=spf1 include:spf.protection.outlook.com -all, and DKIM uses two CNAME records, selector1._domainkey and selector2._domainkey (Microsoft’s DNS records guide lists them all). If your mail stays on your old hosting, the MX will usually point at something like mail.example.com, which in turn has its own A record. Leave that A record alone too.
Two rules worth knowing while you are in the zone: a domain must have only one SPF record (two TXT records starting with v=spf1 break SPF for both), and DKIM and DMARC records live on their own subdomains, so changing the main A record never touches them.
What should you check before touching anything?
- Export the full record list from the current DNS. Don’t trust memory — a zone typically holds 20 to 30 lines, and one forgotten subdomain stops working the moment you switch.
- Look at what the MX record points to. If it points at the domain itself, change it to
mail.yourdomain.comfirst and wait a day before moving the site. - Read the SPF record. If it contains
+a, replace that with the mail server’s actual IP address. - Check the mail apps. In Outlook or on a phone, the incoming and outgoing server should be
mail.yourdomain.com, not the bare domain. If it’s the bare domain, mail stops the instant you move — because of the phone’s settings, not DNS. - Lower the TTL on the records you plan to change to five minutes, at least a day ahead. TTL is how long the world remembers the old answer. With a 24-hour TTL, a mistake gets fixed tomorrow.
The move itself
Order matters:
- Put the site on the new server and confirm it works — easiest with a temporary address, or your own computer’s hosts file.
- Issue the SSL certificate for the new server before switching. Change the record while the certificate is still being issued and visitors get a security warning.
- Change only the A or CNAME record for the domain and for
www. - Leave MX, webmail, cPanel, FTP and the TXT records exactly as they are.
- Check the site from an outside network — mobile data does the job — then immediately send a test message to and from an address on the domain.
A TTL timeline that works
Suppose the A record currently has a TTL of 86400 seconds (24 hours):
- Day 1, morning: lower the TTL on the A and
wwwrecords to 300 seconds (five minutes). Resolvers that looked the record up just before this change may keep the old answer for up to 24 hours, so you wait. - Day 2, morning or later: make the switch. Now any mistake is corrected for most visitors within minutes.
- Day 3 or later: once everything is confirmed, raise the TTL back to an hour or more.
The rule of thumb: wait at least as long as the old TTL before relying on the new one.
If you are changing DNS provider as well
Moving the site to a new server is one change. Moving the whole DNS zone to a new provider, for example to Cloudflare, by changing the nameservers at your registrar is a bigger one, and it is where email most often goes missing. The order that keeps mail safe:
- Recreate every record from your export at the new DNS provider: MX, all TXT records (SPF, DKIM, DMARC, and any verification records),
mail,webmail,autodiscoverand every other subdomain. Some providers import the existing zone automatically; check the result line by line anyway. - Compare the two zones before switching. Query the new provider’s nameservers directly and confirm the MX and TXT answers match the old ones exactly.
- Turn off DNSSEC at the registrar first if the old provider signed the zone. A leftover DS record that doesn’t match the new provider makes the whole domain, email included, fail to resolve for resolvers that validate DNSSEC. Re-enable it with the new provider afterwards.
- Change the nameservers at the registrar. This can take up to a day or two to be seen everywhere, so leave the old zone untouched until it has.
How to check the records yourself
On a Mac or Linux terminal, dig shows what the world sees:
dig +short MX example.com
dig +short TXT example.com
dig +short TXT _dmarc.example.com
dig +short A example.com
On Windows, nslookup -type=mx example.com and nslookup -type=txt example.com do the same job. Run them before the move and save the output; after the move, the MX and TXT answers should be identical and only the A record should have changed.
The first 24 hours
DNS does not change everywhere at once. Providers hold the old answer for different lengths of time, so for a day part of the world sees the new site and part sees the old one. That is normal and not a reason to panic.
The unpleasant exception is a provider that mixes old and new answers — it remembers the old MX record but looks the domain up afresh. Messages then head for the wrong server. Sending servers retry over the following hours, so mail isn’t lost, but it can be delayed. That is precisely why the first item on the checklist above is to fix the MX record before the move rather than during it.
For that first day, two things are worth watching: whether the site opens from several different networks, and whether mail is arriving as usual.
Is it even worth moving the email too?
Usually not. Email is rarely the reason for changing hosting, and migrating it carries a real risk of lost messages and days of fiddling with settings on everyone’s phone. The calmest approach is to move the site to where it will run faster and leave the mail where it is. The two don’t need to live on the same server — and mostly they’re better off not doing so.
When we moved the site of the accounting firm Troya Consult, the mail stayed with the old provider and didn’t stop for a minute, even though the site changed both its server and its DNS provider.
When NOT to move the site this week
Some moments are simply bad timing. Wait if:
- you don’t have the DNS login yet, or you aren’t sure which company holds the domain. Find out first; guessing under pressure causes most outages;
- the domain is close to expiry or in the middle of a transfer between registrars. Many registrars also block a new transfer for 60 days after registration or a previous transfer;
- it is your busiest week of the year, or the day before a holiday when nobody will be around to check mail;
- you plan to move the email as well. Do the website first, let it settle, then plan the email move as a separate project.
Short checklist
- Full list of DNS records exported and saved
- MX points at a mail subdomain, not the bare domain
- SPF without
+a, using a specific IP - Mail apps set to
mail.yourdomain - Only one SPF record, and DKIM and DMARC records noted
- TTL lowered in advance
- If changing DNS provider: every record recreated and compared, DNSSEC handled
- New site live with a valid SSL certificate before the switch
- Only the site and
wwwrecords changed - Test message both ways immediately afterwards
If that checklist reads like work you’d rather not do, it is part of building a website with us. We move the domain and the site; your only job with the email is confirming that messages still arrive.