I am trying to get sendmail to transfer mails to the servers specified in the MX records so when the server sends an email to me@domain.com I want it to skip localhost and go straight to gmail.
I've gone over the sendmail docs, but don't quite understand how to account for my situation. Essentially my server's hostname is 'www.domain.com' but when I send an email to 'me@domain.com' it ends up in the local mail spool.
When I run sendmail in debug mode:
sendmail -bt
> $=w
I get:
www.domain.com
www.domain.com.
domain.com
localhost
[54.245.___.___]
So, it is intercepting all outgoing mail to domain.com
. I dont want it to arrive at localhost
. I want it to go to gmail servers.
All mail bound for other addresses works fine. I also have sendmail configured to use DKIM.
I've added a record to mailertable (and rebuilt the mailertable.db and recompiled the mc>cf file) but I'm not sure if that's what I need to do or if I am doing it correctly.
domain.com esmtp:[aspmx.l.google.com]
How do I get it to allow mail bound for users@domain.com to leave the server?
ADDITIONAL INFO: Here is my sendmail.mc file:
divert(-1)dnl
include(`/usr/share/sendmail-cf/m4/cf.m4')dnl
VERSIONID(`setup for linux')dnl
OSTYPE(`linux')dnl
define(`confDEF_USER_ID', ``8:12'')dnl
define(`confTO_CONNECT', `1m')dnl
define(`confTRY_NULL_MX_LIST', `True')dnl
define(`confDONT_PROBE_INTERFACES', `True')dnl
define(`PROCMAIL_MAILER_PATH', `/usr/bin/procmail')dnl
define(`ALIAS_FILE', `/etc/aliases')dnl
define(`STATUS_FILE', `/var/log/mail/statistics')dnl
define(`UUCP_MAILER_MAX', `2000000')dnl
define(`confUSERDB_SPEC', `/etc/mail/userdb.db')dnl
define(`confPRIVACY_FLAGS', `authwarnings,novrfy,noexpn,restrictqrun')dnl
define(`confAUTH_OPTIONS', `A')dnl
define(`confTO_IDENT', `0')dnl
FEATURE(`no_default_msa', `dnl')dnl
FEATURE(`smrsh', `/usr/sbin/smrsh')dnl
FEATURE(`mailertable', `hash -o /etc/mail/mailertable.db')dnl
FEATURE(`virtusertable', `hash -o /etc/mail/virtusertable.db')dnl
FEATURE(redirect)dnl
FEATURE(always_add_domain)dnl
FEATURE(use_cw_file)dnl
FEATURE(use_ct_file)dnl
FEATURE(local_procmail, `', `procmail -t -Y -a $h -d $u')dnl
FEATURE(`access_db', `hash -T<TMPF> -o /etc/mail/access.db')dnl
FEATURE(`blacklist_recipients')dnl
DAEMON_OPTIONS(`Port=smtp,Addr=127.0.0.1, Name=MTA')dnl
FEATURE(`accept_unresolvable_domains')dnl
FEATURE(`relay_based_on_MX')dnl
FEATURE(`relay_entire_domain')dnl
LOCAL_DOMAIN(`localhost.localdomain')dnl
MASQUERADE_AS(`domain.com')dnl
MASQUERADE_DOMAIN(`localhost.localdomain')dnl
EXPOSED_USER(`root')dnl
FEATURE(masquerade_envelope)dnl
FEATURE(masquerade_entire_domain)dnl
INPUT_MAIL_FILTER(`opendkim', `S=inet:8891@localhost')
MAILER(smtp)dnl
MAILER(procmail)dnl