Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

stefr's avatar

Move new client to our server(s), how do you move email accounts?

Hi,

New clients often already have a website (with email) on a shared hosting account somewhere. I'm always struggling to find a way to move their email accounts to a new email server (since the shared hosting is no longer used after we move the website to our servers). Since we use Forge, we do not offer email hosting. We prefer using Office365, Google Apps or email only on transip.nl. However, the move issues apply on all of the 'new' services.

Switching the website to our server with dns is never a problem, but email is always tricky.

Example: We would like to move mydomain.com from ip: 111.111.111.111 to the new server on 222.222.222. When we switch the ip's in the DNS records this can go wrong:

An email is send to info@mydomain.com. The dns from the sender was not propagated yet. The email will be delivered to the mailbox on 111.111.111.111. This 'old' mailbox will accept the email and will not send an error to the sender. The client wants to pull his email. His dns was propagated already, but he tries to pull the email from 222.222.222.222. He won't get the email that was delivered in 111.111.111.111.

I'm sure I'm not the only one struggling with this. I curious how you're handeling this?

0 likes
7 replies
Snapey's avatar

I keep a reseller account with a shared hosting company and then use their email services. Then change the DNS to point domain.com and www.domain.com to a droplet on Digital Ocean. it's not necessary for the DNS and email etc to be with the same provider.

stefr's avatar

Hi @Snapey Thanks for your reply, but my question is how to create a seamless transition from one email server to another.

londoh's avatar
londoh
Best Answer
Level 5

I havent done this for a while, so below is from memory and assumes you have access to dns records:

The day before you start, reduce the TTL on the mailserver DNS down to a short period - 1min, 5mins - whatever you think is reasonable and practical. On the day, once you have everything ready, turn off mail server for the domain. At this point old.mailserver is no longer accepting mail.

In case of non-delivery most (all?) MTA's will resend after (I forget but something like...) 5mins 15 mins, 1 hour, then every 4 hours, for up to 5 days. So any mail not delivered in the down time interval will be resent by the sending server.

Backup and copy email over to new server.

Switch the dns for the mail server to the new ip

Turn on the new mail server for the domain.

At this point because of the low ttl any sending server will pick up the new dns pretty quickly and re-send.

Once its all working reset the dns ttl.

Maybe that helps

regards

l.

1 like
Snapey's avatar

My point was, don't exclude the option of just leaving the email where it was.

Migrating email to a new server (and particularly so if moving to gmail etc) is a project in its own right.

Please or to participate in this conversation.