Possible Duplicate:
Outgoing mail from linux not being delivered

I'm sending email from a server, let's say domain.com.

I also have Google Apps email set up for hosted email, same domain, domain.com.

If I get mail sent to me from anywhere else, I receive things just fine. However, if the email originates from my server, it just ends up in /var/mail/root as a delivery error saying the user is unknown.

I created a user on the server for the name which is having trouble, webmaster@domain.com. Retried sending and it sends, but not to my hosted email at Google Apps. I just receive it at /var/mail/webmaster now.

I'm using sendmail. I messed around with /etc/aliases but adding webmaster: webmaster@domain.com looked useless (and I was right.)

Any help?

marked as duplicate by adamo, Scott Pack, Brent Pabst, mdpc, John Gardeniers Oct 12 '12 at 6:34

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.


It sounds like your server thinks it is domain.com and is therefore trying to deliver the mail locally rather than sending it out to the Internet.

The easiest solution is to rename the server. But this won't cover the case of getting local mail to be delivered remotely. In that case, move on to:

Next easiest is to configure the mail server to send all mail to a smarthost (in this case Google). How you do this depends on which MTA the machine is running (sendmail, postfix, etc.) but instructions can be found easily enough by searching the Internet.

  • Renaming the server won't do much - the MTA just needs to be convinced that domain.com isn't local. – EEAA Aug 28 '12 at 1:17
  • If he literally named the machine domain.com then that's what's going on. Even something as simple as renaming it, e.g. www.domain.com would be sufficient. Of course, if he explicitly wants local mail to be delivered to Google Apps, then it's the second option. – Michael Hampton Aug 28 '12 at 1:27
  • Actually this (web server at a hosting provider and mail at Google Apps) has been asked many times at SF. And it is doable with sendmail – adamo Aug 28 '12 at 11:05
  • Adamo nailed it! – Orlando Aug 28 '12 at 23:16

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