Take the 2-minute tour ×
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 balkan-preferans.de ( to my address First.Last@gmail.com - this is done by the following DNS-zone served by my hoster:

$TTL 86400
@   IN SOA ns1.first-ns.de. postmaster.robot.first-ns.de. (
    2012100402   ; serial
    14400        ; refresh
    1800         ; retry
    604800       ; expire
    86400 )      ; minimum

@                        IN NS      robotns3.second-ns.com.
@                        IN NS      robotns2.second-ns.de.
@                        IN NS      ns1.first-ns.de.

@                        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/sendmail.mc so that all mail for the balkan-preferans.de is accepted and then relayed to my address First.Last@gmail.com?

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 sendmail.mc - just add

@balkan-preferans.de first.last@gmail.com

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 sendmail.mc? –  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 sendmail.mc. –  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 balkan-preferans.de 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 sendmail.mc, regenerate sendmail.cf 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.