Sendmail: Mails are still being relayed to root@localhost

Solution 1:

Include mailer specification in your smart host definition and put the IP address inside square brackets.

define(`SMART_HOST', `relay:[192.168.0.2]')

Solution 2:

I tried that and still did not work.

However, i looked around somemore and foudna solution. What was happening was that 'proxy''s sendmail kept checking with my DNS servers to resolve for the location of 'auth' although it did not have internet. As such, when it failed it fell back to root@localhost as a relay agent.

I needed to force proxy's sendmail to look up my /etc/hosts file instead. to do that , i did the follwowing:

In /etc/mail/submit.mc file :

divert(0)dnl
include(`/usr/share/sendmail-cf/m4/cf.m4')
VERSIONID(`linux setup for RHEL')dnl
define(`confCF_VERSION', `Submit')dnl
define(`__OSTYPE__',`')dnl dirty hack to keep proto.m4 from complaining
define(`confTIME_ZONE', `USE_TZ')dnl
define(`confDONT_INIT_GROUPS', `True')dnl
define(`confPID_FILE', `/var/run/sm-client.pid')dnl
define(`SMART_HOST',`my smarthost from /etc/hosts')dnl
define(`PROCMAIL_MAILER_PATH',`/usr/bin/procmail')dnl
define(`ALIAS_FILE', `/etc/aliases')dnl
MASQUERADE_AS(`Your DNS domain: example.com')dnl
FEATURE(masquerade_envelope)dnl
FEATURE(masquerade_entire_domain)dnl
FEATURE(`use_ct_file')dnl
MAILER(smtp)dnl
MAILER(procmail)dnl

Also, create in /etc/mail a server.switch file :

hosts files aliases files

Credits to : http://www.tenox.net/docs/force2smarthost.html for the solution.

Also, thanks to Andrez for the quick help.