Background
We use Google Apps for email with our domain example.com
:
[ec2-user@example ~]$ dig MX example.com
…
;; ANSWER SECTION:
example.com. 300 IN MX 1 aspmx.l.google.com.
example.com. 300 IN MX 5 alt1.aspmx.l.google.com.
example.com. 300 IN MX 5 alt2.aspmx.l.google.com.
example.com. 300 IN MX 10 aspmx2.googlemail.com.
example.com. 300 IN MX 10 aspmx3.googlemail.com.
…
On the same domain we have an EC2 instance running, with Amazon Linux AMI
(Centos based). sendmail
works fine for non-example.com addresses. However,
for example.com-addresses, 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.
Question
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
andec2-user
to the Google Apps useradmin@example.com
. I guess, we would use mail aliases for that.FQDN:
[ec2-user@example ~]$ hostname --fqdn example.com
Of course, the actual server name is not
example.com
. 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> > example.com > [ec2-user@example ~]$