Email and DNS servers - how does it work?
July 27, 2011 3:10 AM   Subscribe

I am in the process of changing my web hosting service. I have a bunch of questions about what's going to happen to my email.

This is a total n00b question so I apologise in advance.

I have just changed the DNS server settings for my website, let's call it No problems there, and within a day or three I guess my site will switch over to the new host.

My question is, what happens to my email in the meantime? Let's say I have and it forwards to Gmail. I've set up my mail forwarding at my new host, so my mail should then be forwarded to my Gmail inbox, right? Once the new DNS server settings kick in, will my email also move to the new host? Or do I need to do something else?

If my email will move automatically, when will it move, and will any mails get lost in the meantime?

Again, sorry for my idiocy, I'm just trying to work out what will happen and Google only gives me answers which are far above or below my level of understanding.

posted by rubbish bin night to Computers & Internet (5 answers total) 2 users marked this as a favorite
DNS is a distributed system, but changes occur instantly. The delay depends on what the TTL (time to live) was set on the previous entry, and whether each resolver has your name in its cache or not. Say your old TTL on the MX record (this is what tells mail how to be delivered) was set to 86400, which is 24 hours in seconds. A remote system that wants to deliver mail will go to look up that MX record. If it had already looked up that record in the last 24 hours, then it will still have a cached value that is valid according to the TTL, so it will continue to use the old value. If the resolver has not looked up that value before or if it looked it up more than TTL seconds ago, it will have expired and it will have to look it up again, and it will get the new value. So during that period, some servers will be trying to deliver using the old MX record and some will be using the new MX record, meaning you'll get a mixture of deliveries headed to both hosts.

In the future, if you want to avoid this the way to do it is to preemptively lower the TTL value ahead of the move. For example, if it was set to 24 hours, then at some point greater than 24 hours before the move you should set it the TTL to something like 60 seconds. That way when it comes to actually do the move, you can be assured that all the caches that had the old 24 hour value have expired, and any caches now have the 60 second value. Now when you make the change, the period of time during which both records are valid will only last 60 seconds. After that, you can set it back to 24 (or 36, 48, whatever) hours to reduce traffic.
posted by Rhomboid at 4:47 AM on July 27, 2011 [2 favorites]

During the transition period, some of your mail will still go to your old host (which will then forward it to gmail just as before). Mail from the parts of the Internet that have picked up the news about the DNS change will go to your new host. If you have that host configured to receive that mail and forward it to gmail too, then you won't even see a difference, it'll all just work.
posted by ook at 4:56 AM on July 27, 2011

If you have the account rbn set up at your new host in advance of the switch, then the worst that will happen, as Rhomboid said, is that a few e-mails will go astray to the old host for a brief period. If it's gmail-based, you should still have access to the old system using your username, right?

Otherwise, every e-mail should continue to get delivered either to your new host or your old one.

I try to do server transitions of this type on a Friday afternoon after working hours for this reason, but the likelihood is you'll lose little if any mail.
posted by randomkeystrike at 4:57 AM on July 27, 2011

Keep in mind that many hosts (but still a minority) ignore TTL and cache longer than they "should" to save from having to do so many lookups on their end. Just google either "ignoring dns ttl" or "providers dns ttl ignored" or something and you'll read many stories.

With a few iptables rules (sorry, just know Linux, I'm sure there's Windows equivs) you can just take all incoming port 25 (and 80 and 110 and whatever other services you've got) and redirect to the new server while you wait for DNS to propogate.
posted by Brian Puccio at 5:31 AM on July 27, 2011

I'm not sure whether you're asking this, but: existing messages stored on your old server will _not_ be on the new server, unless you've made a special arrangement with both hosting companies.
posted by amtho at 7:29 AM on July 27, 2011

« Older There's a beach but no-one to walk it with!   |   Interactive fiction game title... Newer »
This thread is closed to new comments.