Install Sendmail in CentOS 6


1. Install the following packages

# yum install m4 telnet mailx

2. Check if sendmail is already installed

# rpm -qa | grep sendmail

If not, install sendmail

# yum install sendmail sendmail-cf

Sendmail configuration files are in /etc/mail directory.

Sendmail listens on local interface i.e. 127.0.0.1

# ps -ef | grep -v grep | grep -i sendmail

#netstat -tulnp | grep :25 | grep tcp

# vi /etc/mail/sendmail.mc

Adapt the file as per the smtp settings as explained later.

# Build the sendmail.cf file using m4 macro

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

Add the domains for which you will accept mail, such that one domain is added per line. If this mail server has to accept mails for the domains example.com and example.co.in, then

# vi /etc/mail/local-host-names

example.com

example.co.in

Add sendmail to start script

# chkconfig –add sendmail

Restart sendmail service

# service sendmail restart

Reboot the machine

# reboot

To check the log from sendmail, check the maillog file in /var/log/maillog

# tail -f /var/log/maillog