Sign up ×
Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

I'm currently using Google Apps to forward mails addressed to recipients at my domain ( to my address - this is done by the following DNS-zone served by my hoster:

$TTL 86400
@   IN SOA (
    2012100402   ; serial
    14400        ; refresh
    1800         ; retry
    604800       ; expire
    86400 )      ; minimum

@                        IN NS
@                        IN NS
@                        IN NS

@                        IN A
localhost                IN A
www                      IN A
@                        IN MX 1    ASPMX.L.GOOGLE.COM.
@                        IN MX 5    ALT1.ASPMX.L.GOOGLE.COM.
@                        IN MX 5    ALT2.ASPMX.L.GOOGLE.COM.
@                        IN MX 10   ASPMX3.GOOGLEMAIL.COM.
@                        IN MX 10   ASPMX2.GOOGLEMAIL.COM.

This has worked well for the past year, but I'd like to get rid of Google Apps, because they aren't free of cost anymore and I don't use any other features of that product.

So I'd like to change the MX-records above to point to my 2 web servers - which run 24/7 anyway.

On the servers with CentOS 6 Linux I currently run sendmail (for sending logwatch mails mainly).

Could anybody please provide some hints on which macros to add to /etc/mail/ so that all mail for the is accepted and then relayed to my address

Do I have to open an incoming port in iptables firewall too?

share|improve this question

1 Answer 1

up vote 2 down vote accepted

I don't think you need to mess with - just add

to the /etc/mail/virtusertable and you should be good to go.

This assumes sendmail is set up to correctly receive mail for that domain, which I'm further assuming you've ensured already.

share|improve this answer
Ok I get it - this will "rewrite" the recipients. But I actually haven't set up anything yet to receive mail for that domain (besides MX records) - where should I do it, in – Alexander Farber Dec 21 '12 at 15:45
Add the names of the "servers" you set the MX records to to /etc/sendmail/local-host-names. You may need to remove the loopback address from the active DAEMON_OPTIONS line in – John Dec 21 '12 at 15:51
Thank you and the incoming port to open in iptables is 25? And how do I test delivery/acceptance, by connecting telnet 25? And why remove the loopback adress, I currently have DAEMON_OPTIONS(Port=smtp,Addr=, Name=MTA')` there. – Alexander Farber Dec 21 '12 at 15:59
I usually test delivery by just sendmail an email, I'm too lazy to type everything out in a telnet session. But yes, that should let you test. – John Dec 21 '12 at 16:01
You have to remove the Addr= part from, regenerate and restart sendmail. – adamo Dec 22 '12 at 21:04

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.