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, [email protected] 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: [email protected] looked useless (and I was right.)
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.
This work is licensed under a Creative Commons Attribution-ShareAlike 3.0 Unported License.