redirect all e-mail to a new server

S2S-Robert

Verified User
Joined
Jun 24, 2003
Messages
415
Location
The Netherlands
We are going to migrate to a new server and I was thinking about the e-mail. Is it possible to reroute the e-mail coming in to the old box to go automatically to the new box?

I believe Exim checks if the domain actually exists on localhost and if not it sends to another server. What do I have to change in order to reroute all e-mail to the new server?

And what do I have to do in order to let Exim (or whichever software) know that the domain is running on another IP adres? Is just changing the ip adresses of the name server (through the registrar), enough? This would mean that the ip address of ns1.hostname.com & ns2.hostname.com would be changed.
 
Hello,

To forward all emails to another box just clear out all the domains from the /etc/virtual/domains file. Then just change all of the MX records to point to the new server. That will forward the email there. Just make sure that the other server is setup to receive all the email accounts.

John
 
I'm running 160 domains, so manually changing all the mx records of all domains will be quite undoable. Is there no other way then to change the mx records? Or batch change the mx records? Or change some exim configuration that forwards by default all mails to a specific ip?
 
Hello,

You could try:
Code:
perl -pi -e 's/MX.*/MX \t 0 \t otherserver.com./' /var/named/*.db
service named reload
John
 
And otherserver.com can also be an ip adress?

And secondly you're sure this won't f*ck up every DNS setting for the domains right? :D
 
Hello,

I think an IP might work, but it may be against the rules for what an MX record is supposed to be. I'd just enter any domain on that server.. just as long as it resolves (hostname or something).

You cant test it out on one file at a time if you want:
Code:
perl -pi -e 's/MX.*/MX \t 0 \t otherserver.com./' /var/named/domain.com.db
Just to get comfortable :) I tested it on one domain here.. but you may want to test it for yourself to be sure ;)

John
 
Back
Top