Thursday, 9 March 2017

Linux sendmail configuration using microsft exchange setup step by step


Below steps will help to configure the sendmail alert using microsoft exchange


Step: Check the RPM’s(sendmail and m4) are installed in RHEL

Rpm –qa|grep –i send If no sendmail rpms are installed then install the below RPM’s

Then install m4 rpm

++ After that you can see the folder /etc/mail

Now edit /etc/mail/sendmail.mc

++ 1st edit /etc/mail/sendmail.mc

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

++ 2nd edit, add below line after MAILER

FEATURE(`relay_hosts_only')dnl
MAILER(smtp)dnl

Save the file /etc/mail/sendmail.mc then

++ 3rd add below,
# hostname >> /etc/mail/relay-domain

++ 4th Recompile
m4 /etc/mail/sendmail.mc > /etc/mail/sendmail.cf

If you get the error “/etc/mail/sendmail.mc:10: m4: cannot open `/usr/share/sendmail-cf/m4/cf.m4': No such file or directory”

Install RPM sendmail-cf* like
rpm –ivh sendmail-cf*

And retry

++ After that add exchange server details in /etc/mail/sendmail.cf
FROM:
# "Smart" relay host (may be null)
DS

TO:
# "Smart" relay host (may be null)
DSExchangeserver.com

++ After that restart the sendmail

# /etc/init.d/sendmail restart
Shutting down sm-client:                                   [  OK  ]
Shutting down sendmail:                                    [  OK  ]
Starting sendmail:                                         [  OK  ]
Starting sm-client:                                        [  OK  ]

Now test the mail server
echo "Subject: sendmail test" | sendmail –v abc@xyz.com

You can verify the logs /var/log/maillog

No comments: