In case you have a local network server and you want to send mail from it to a another server in the local network. You will need to bypass the DNS lookup for the hostname which the mail server performs by default by using sendmail.
You need to make sure that postfix is disable or uninstalled
service postfix stop
For Centos 6
chkconfig --del postfix
For Centos 7
/bin/systemctl disable sendmail.service
Remove postfix
yum remove postfix
Then make sure that postfix service is not run
ps aux | grep postfix
Now you need to edit the /etc/hosts file and add target mail server on the local network by adding your line like this e.g:
192.168.1.2 mail mail.kfirman,com kfirman.com
yum install sendmail sendmail-cf sendmail-devel sendmail-milter m4
vi /etc/mail/mailertable
Add the mail server name and IP of the local network like this e.g:
mail.kfirman.com esmtp:[192.168.1.2]
kfirman.com esmtp:[192.168.1.2]
makemap -v hash /etc/mail/mailertable < /etc/mail/mailertable
vi /etc/mail/sendmail.mc
And comment out the DEAMON_OPTIONS(`Port-smtp,
m4 /etc/mail/sendmail.mc > /etc/mail/sendmail.cf
/bin/systemctl start sendmail.service
/bin/systemctl enable sendmail.service
# go to the target mail server and see the log
tail -f /var/log/maillog
Be First to Comment