I can't get sendmail to stop considering itself as localhost.localdomain

Hi,
I am tearing my hair out, here. We have a CentOS 4.7 box running sendmail 8.13.1.

I can't send e-mail out from that box to anywhere not on localhost, as I keep getting the error 'DSN Data Format error', and 'A real domain name is required to send e-mail'.

I have edited the /etc/mail/sendmail.mc file as such:

LOCAL_DOMAIN(`localhost.localdomain')dnl
MASQUERADE_AS(`my.companyname.com')dnl
MASQUERADE_DOMAIN(`my.companyname.com')dnl

I then do

m4 /etc/mail/sendmail.mc >  /etc/mail/sendmail.cf

I then restart sendmail..

/etc/init.d/sendmail restart

And I do..

/usr/lib/sendmail -d0.12 < /dev/null

.. and there, right at the bottom, is ..

====== SYSTEM IDENTITY (after readcd) =======
(short domain name) $w = localhost
(canonical domain name) $j = localhost.localdomain
(subdomain name) $m = localdomain
(node name) $k = name_of_the_host

I even tried going into sendmail.cf, searching for $w and entering my domain name after it, and then restarting sendmail. No luck.

I am going insane. Please help. :frowning:

I think sendmail gets a domain name (or first item in search list) from /etc/resolv.conf,
and a hostname from /etc/hosts, where the hosts: line in /etc/nsswitch.conf matters.
It will certainly succeed when

getent hosts `hostname`

returns a FQDN.
Maybe you should not override that with localhost.localdomain...

Sorry to get back to you so late. Nope, the box is still sending e-mails as 'localhost.localdomain', despite the fact that there is not a single instance of that word anywhere in /etc/mail.

HELP!!

That means the command returned an FQDN,
and you have omitted

LOCAL_DOMAIN(`localhost.localdomain')dnl

and built a new sendmail.cf?