Smart Host Server :
Enable remote delivery and relay access in /etc/mail/sendmail.mc
Change-1
LOCAL_DOMAIN(`localhost.localdomain')dnl
Comment this line
dnl LOCAL_DOMAIN(`localhost.localdomain')dnl
Change-2
dnl # 127.0.0.1 and not on any other network devices. Remove the loopback
dnl # address restriction to accept email from the internet or intranet.
dnl #
DAEMON_OPTIONS(`Port=smtp,Addr=127.0.0.1, Name=MTA')dnl
Edit the line as
DAEMON_OPTIONS(`Port=smtp, Name=MTA')dnl
Make the /etc/mail/sendmail.mc
make -C /etc/mail
make: Entering directory `/etc/mail'
make: Leaving directory `/etc/mail'
Allow the subnet/IP for relay mail in /etc/mail/access file
Step-1
Add the following line in /etc/mail/access file
172.25.1 RELAY # Same as 172.25.1.0/24
Step-2
Enter the following command to update the /etc/mail/access.db
makemap hash /etc/mail/access < /etc/mail/access
Restart the sendmail service
[root@SL-APP-SRV001 ~]# service sendmail restart
Shutting down sm-client: [ OK ]
Shutting down sendmail: [ OK ]
Starting sendmail: [ OK ]
Starting sm-client: [ OK ]
Sendmail Relay Client:
Point the smart host server to the local relay /etc/mail/sendmail.mc
Add the following line
define(`SMART_HOST', `smarthost.server.name')dnl
Make the /etc/mail/sendmail.mc
make -C /etc/mail
make: Entering directory `/etc/mail'
make: Leaving directory `/etc/mail'
Restart the sendmail service
[root@SL-APP-SRV001 ~]# service sendmail restart
Shutting down sm-client: [ OK ]
Shutting down sendmail: [ OK ]
Starting sendmail: [ OK ]
Starting sm-client: [ OK ]
Check the mail is working or not from smart host client
mutt -s "CPU Log" debjyoti.mail@gmail.com -a "/rescue/monitoring_script/log_files/cpu.log" < /rescue/monitoring_script/log_files/cpu_message.txt
Checking log
/var/log/maillog of Client
Dec 24 16:13:08 dbserver1 sendmail[54338]: tBOAh8nt054338: from=root, size=10675, class=0, nrcpts=1, msgid=<20151224104308.GA54336@dbserver1.debjyoti.local>, relay=root@localhost
Dec 24 16:13:10 dbserver1 sendmail[54339]: tBOAh8Up054339: from=<root@dbserver1.debjyoti.local>, size=10838, class=0, nrcpts=1, msgid=<20151224104308.GA54336@dbserver1.debjyoti.local>, proto=ESMTP, daemon=MTA, relay=localhost.localdomain [127.0.0.1]<--- Putting mail to local mail queue
Dec 24 16:13:10 dbserver1 sendmail[54338]: tBOAh8nt054338: to=debjyoti.mail@gmail.com, ctladdr=root (0/0), delay=00:00:02, xdelay=00:00:02, mailer=relay, pri=40675, relay=[127.0.0.1] [127.0.0.1], dsn=2.0.0, stat=Sent (tBOAh8Up054339 Message accepted for delivery)<--- Local queue accepted for delivery
Dec 24 16:13:10 dbserver1 sendmail[54341]: tBOAh8Up054339: to=<debjyoti.mail@gmail.com>, ctladdr=<root@dbserver1.debjyoti.local> (0/0), delay=00:00:02, xdelay=00:00:00, mailer=relay, pri=130838, relay=relay.debjyoti.local. [172.25.1.35], dsn=2.0.0, stat=Sent (tBOAko7Y011291 Message accepted for delivery) <--- Delivered to the relay server (172.25.1.35)
/var/log/maillog of Server
Dec 24 16:16:50 SL-APP-SRV001 sendmail[11291]: tBOAko7Y011291: from=<root@dbserver1.debjyoti.local>, size=11050, class=0, nrcpts=1, msgid=<20151224104308.GA54336@dbserver1.debjyoti.local>, proto=ESMTP, daemon=MTA, relay=dbserver1 [172.25.1.66] <--- Accepted mail from clent (172.25.1.66)
Dec 24 16:16:51 SL-APP-SRV001 sendmail[11293]: STARTTLS=client, relay=gmail-smtp-in.l.google.com., version=TLSv1/SSLv3, verify=FAIL, cipher=ECDHE-RSA-AES128-GCM-SHA256, bits=128/128
Dec 24 16:16:53 SL-APP-SRV001 sendmail[11293]: tBOAko7Y011291: to=<debjyoti.mail@gmail.com>, delay=00:00:03, xdelay=00:00:03, mailer=esmtp, pri=131050, relay=gmail-smtp-in.l.google.com. [74.125.200.26], dsn=2.0.0, stat=Sent (OK 1450953800 fm6si3206966pab.122 - gsmtp) <--- Delivered to Gmail