Install and Setup Sendmail as Mail Relay

Install Sendmail

# yum install sendmail
# yum install sendmail-cf

Go to /etc/mail Directory
# cd /etc/mail

Edit sendmail.mc File:

remark:
dnl #DAEMON_OPTIONS(`Port=smtp,Addr=127.0.0.1, Name=MTA')dnl
dnl #FEATURE(`accept_unresolvable_domains')dnl
Add:
DAEMON_OPTIONS(`Port=smtp, Name=MSA, M=E')dnl
FEATURE(`relay_based_on_MX')dnl

Recompile Sendmail Configuration

# m4 /usr/share/sendmail-cf/m4/cf.m4 ./sendmail.mc > ./sendmail.cf

Add Allowed IPs to connect file, edit access file:

vi access
Add:
Connect:localhost RELAY
Connect:127.0.0.1 RELAY
Connect: xx.x.x.xx RELAY
Connect: xx.x.x.xx RELAY
Connect: xx.x.x.xx RELAY

Run makemap hash Command

# makemap hash ./access.db < ./access

CENTOS 6 Command

# service sendmail start | stop | restart

CENTOS 7 Command

# systemctl start | stop | restart sendmail

Be the first to comment

Leave a Reply

Your email address will not be published.


*