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.)

1 Answer
1

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.
–
EEAAAug 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
–
adamoAug 28 '12 at 11:05