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 running a debian server that hosts multiple domains, each of them using google apps. I managed to get sendmail to deliver the emails from domain1.com by using the following in /etc/mail/sendmail.mc:

define(`MAIL_HUB', `domain1.com.')dnl
define(`LOCAL_RELAY', `domain1.com.')dnl

But I need to do the same with domain2.com. I (innocently) tried domain1.com., domain2.com. and domain1.com.; domain2.com. without success. Is there any -simple- way to get it working?

share|improve this question

1 Answer 1

If I understand the question correctly your Debian server is the web host for these domains, for which mail goes to Google Apps. For email to work OK (eg. you have a form on the web server which emails you and you want this email delivered to the Google Apps account) you need to modify rule set 0 in your sendmail.mc as shown in this SF thread. You need to have one rule for each of the domains:

R $* < @ domain1.com. > $*           $#esmtp $@ [$(bestmx domain1.com. $)] $: $1 < @ domain1.com. > $2
R $* < @ domain2.com. > $*           $#esmtp $@ [$(bestmx domain2.com. $)] $: $1 < @ domain2.com. > $2
share|improve this answer
hi, sorry for the -very- late reply, but I tried to follow the article from your blog but nothing has changed. This rule doesn't seem to do anything for me unfortunately. My outgoing email from domain2.com as still marked in gmail as mailed by: domain1.com –  Nicolas May 11 '12 at 10:41
Your Debian installation comes with a generic sendmail.mc. You have to add the rules at the bottom of the file and then run sendmailconfig. "Nothing happens" does not describe the problem. Please look at your /var/log/mail.log and update the post with its contents so as to understand what goes wrong. You do not need LOCAL_RELAY and MAIL_HUB definitions. –  adamo May 18 '12 at 10:03

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.