sendmail on RedHat 8

Khalid A. Al-Tayaran
Valued Contributor

sendmail on RedHat 8


I'm configuring sendmail on Redhat 8, the /etc/hosts looks like this:

# Do not remove the following line, or various programs
# that require network functionality will fail. redhat localhost.localdomain localhost redhat

I think I need to change the first line (localhost.localdomain) to: localhost localhost.localdomain localhost

According to our HP-UX 11.0 /etc/hosts I have (sendmail is working properly here): localhost loopback hpux

this is working without DNS and using the file /etc/nsswitch.conf with the entry: "hosts: files [NOTFOUND=continue]"

In Redhat Linux /etc/nsswitch.conf I have:

bootparams: nisplus [NOTFOUND=return] files

ethers: files
netmasks: files
networks: files
protocols: files nisplus
rpc: files
services: files nisplus

netgroup: files nisplus

publickey: nisplus

automount: files nisplus
aliases: files nisplus

1 - Do I need to add: hosts: "files [NOTFOUND=return]" for Linux ?
2 - Do I need to modify the first line in the redhat:/etc/hosts file ?
3 - What other settings I should do to configure sendmail on redhat 8 ?
4 - What is the difference between the two versions ?


Stuart Browne
Honored Contributor

Re: sendmail on RedHat 8

Good detailed post, missing one thing though. What's your goal?

1) Nope.
2) Yup. You've got two host entries for the machine 'redhat'. The localhost entry shoudl be enough as: localhost.localdomain localhost

3) see opening satement.
4) of sendmail? Find out what versions of each they are (RH8's is 8.12.5), and check 'changelog' entries at
One long-haired git at your service...
Khalid A. Al-Tayaran
Valued Contributor

Re: sendmail on RedHat 8



I'm trying to receive emails from the Linux box. Currently I'm not receiving anything....

What is the problem ??
Khalid A. Al-Tayaran
Valued Contributor

Re: sendmail on RedHat 8

I forgot to add:

I'm emailing to exchange server (relay) and accessing via outlook.

Johan Nielsen

Re: sendmail on RedHat 8

Does your Exchange server know about the Linux box? If the Exchange server is the corporate e-mail or smart host, depending on your configuration, you will need to tell your Exchange server about this Linux server.

Johan Nielsen

Re: sendmail on RedHat 8

also... you should be able to look at the /var/log/maillog and see if a connection is even being attempted. You can also test sendmail by telneting to port 25 just to make sure that it does answer.
Dave Palica

Re: sendmail on RedHat 8

It sounds like you need to set up an MX record in DNS. An MX record is needed when mail is sent to one host, but needs to be forwarded on to a different host. For example, if you want incoming mail to be addressed as but the mail application (such as exchange) is actually located on, you need to define an MX record as follows: IN MX 0

Now mail sent to will be forwarded to
Khalid A. Al-Tayaran
Valued Contributor

Re: sendmail on RedHat 8

Hi guys:

Out exchange servers don't know anything about UNIX/Linux servers. sendmail on HP-UX is working fine and I'm receiving from unix mail as being sent from

since I wrote in /etc/hosts;

server_IP hostname

Also, the /var/log/mail had these entries:

Jan 9 16:11:04 redhat sendmail[4316]: h074xwd4002346: to=,

ctladdr= (0/0), delay=2+08:11:06, xdelay=00:01:02,
mailer=relay, pri=5160447, relay=, dsn=4.0.0, stat=Deferred: Name serv
er: host name lookup failure
Steven E. Protter
Exalted Contributor

Re: sendmail on RedHat 8

You still have some issues.

If you want to actually accept outside mail on the Linux box, you need to edit /etc/mail/ and authorize that with the following entry.

DAEMON_OPTIONS(`Port=smtp,Addr=, Name=MTA')

You also need to make sure the firewall on the Linux box allows traffic on port 25.

Be careful though, you don't want to open youself up for becoming a spam relay site.

Okay, you need to check /etc/access RELAY

This lets my Exchange server relay mail or the Linux to relay it.

I can't be specific on the firewall because ipchains is the default install on Red Hat 7.3 and I upgraded to iptables.

Last, you need my handy dandy little mail configuration builder to make these changes work right.


# A script designed to rebuild all relavent mail databases after a configuration
# change.

cd /etc/mail
makemap -r -v hash access.db < access
makemap -r -v hash domaintable.db < domaintable
makemap -r -v hash genericstable.db < genericstable
makemap -r -v hash mailertable.db < mailertable
makemap -r -v hash virtusertable.db < virtusertable
cp /etc/ /root
m4 /etc/mail/ > /etc/

vi /etc/
/etc/init.d/sendmail restart

If by chance your Linux server is sending mail to the internet, it needs a fully qualified domain name to get mail onto aol's and yahoo's mail server. yahoo will accept it but not deliver it. aol will reject it in an kind of in your face manner.

Two ways to do this, make your hostname a real domain name registered with netsol et al.

hostname command will return

in /etc/
# my official doma
# ... define this

uncomment the Dj line, overwrite starting with the $ with your official domain name.

Now, understand, aol can tell if you don't own the domain name. Your ISP needs to give the IP addresses valid names related to your domain or you could still have trouble getting mail into aol.

Now as far as exchange goes, you as noted above need to authorize relay because the default is to NOT accept relay mail.

I also recommend btw cold exchange database backkups. That script is not accessible to me from the net so repost if you want it. I have a good backup/restore procedure that really works. I used it two days ago.

More than you expected or wanted.

Sorry, but sendmail is fun and I need to get a life.

Steven E Protter
Owner of ISN Corporation