Wednesday, September 7, 2011

How to install and configure sendmail?

■ Requirement : Install & configure sendmail
■ OS Environment : Linux(RHEL, Centos)
■ Implementation Steps : 

1. Install sendmail  :

$ yum install sendmail*
$ yum install m4*

2. Edit /etc/mail/sendmail.mc & bind daemon with loop back IP. Server's IP can be used too.

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

3. Execute following command :

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

4. Edit /etc/hosts.allow and add following line :

sendmail: ALL

5. Set DAEMON to yes in /etc/sysconfig/sendmail

DAEMON=yes
QUEUE=1h

6. Enable service at boot level :

$ chkconfig sendmain on
$ service sendmail start

Testing :

1. Check whether port 25 is listening  :

$ netstat -tulpn | grep 25
$ telnet localhost 25
$ telnet IP 25

Note : Replace IP address in above command.

2.  Send a test mail :

$ echo test | mail -s test-subject -v  


Note : sendmail configurations files are inside /etc/mail/. Log messages are printed in  /var/log/maillog.

No comments:

Post a Comment