Server Fault is a question and answer site for system and network administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top


We use Google Apps for email with our domain

[ec2-user@example ~]$ dig MX
;; ANSWER SECTION:            300     IN      MX      1            300     IN      MX      5            300     IN      MX      5            300     IN      MX      10            300     IN      MX      10

On the same domain we have an EC2 instance running, with Amazon Linux AMI (Centos based). sendmail works fine for addresses. However, for, it tries to deliver mails locally, which fails for users that exist only on Google Apps. Interestingly this is despite local-host-names being empty.


To avoid local delivery attempts, can we set up sendmail so that it sends all email through Google’s SMTP server (requires authentication)? Would that be a good idea? Or is there a better solution?

Additional information

  • Also, it would be interesting to configure the server to send email to local addresses root and ec2-user to the Google Apps user I guess, we would use mail aliases for that.

  • FQDN:

    [ec2-user@example ~]$ hostname --fqdn

    Of course, the actual server name is not It’s another .com domain.

  • As requested by @AndrzejA.Filip:

    [ec2-user@example ~]$ echo '$j' | sendmail -bt
    ADDRESS TEST MODE (ruleset 3 NOT automatically invoked)
    Enter <ruleset> <address>
    > [ec2-user@example ~]$
share|improve this question
1) Is set as FQDN of the host? echo '$j' | sendmail -bt 2) Does the host accept email from internet? – Andrzej A. Filip Feb 15 '14 at 17:42
@AndrzejA.Filip 1) See updated question. 2) All incoming email for the domain is handled by Google Apps, see MX records. – feklee Feb 16 '14 at 11:05
up vote 3 down vote accepted

You named your server, the naked domain name. Thus many programs (sendmail included) take you at your word, and consider that the local server does everything related to that domain name.

To resolve the problem, rename the host. For this and a variety of other reasons, no server should ever be named with only its naked domain name.

share|improve this answer
I don't understand this answer, why wouldn't you name the server with only its naked domain name? This didn't solve the same issue I was having. – Mike Kormendy Mar 15 '14 at 22:14
@MikeKormendy Then you are clearly not having the same issue. – Michael Hampton Mar 15 '14 at 22:34
Regardless of not having the same issue, it would be beneficial if you provided some background on why no server should ever be named with only its naked domain name. – Mike Kormendy Mar 15 '14 at 23:48
For posterity, @MichaelHampton addresses the reasons here… – Tom Dworzanski Aug 29 '15 at 0:25

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.