Sendmail Configuration – SMTP relay with port 587
Please find the below steps of send mail configuration.
1) Install Sendmail with the below command.
apt-get install sendmail sendmail-cf
2) Please check for saslauthd service, if it is not there on the server then install it with the below command.
apt-get install sasl2-bin
3) Go to vim /etc/default/saslauthd and keep “start=yes”(by default it will be no)
4) Set your authorization informations by putting the following line to /etc/mail/authinfo file:
AuthInfo:abcd.com “U:abcd@gmail.com” “P:1234” “M:PLAIN”
5)Go to vi /etc/mail/sendmail.mc and scroll down to the end of the line and paste the below lines dnl # SMTP Relay setup
define(`RELAY_MAILER_ARGS’, `TCP $h 587′)dnl
define(`ESMTP_MAILER_ARGS’, `TCP $h 587′)dnl
define(`SMART_HOST’, `mail.irsis.ph’)dnl
define(`confAUTH_MECHANISMS’, `EXTERNAL GSSAPI DIGEST-MD5 CRAM-MD5 LOGIN PLAIN’)dnl
FEATURE(`authinfo’,`hash /etc/mail/authinfo’)dnl
6)Update sendmail.cf and access.db files through the below commands
cd /etc/mail
m4 sendmail.mc >sendmail.cf makemap hash authinfo < authinfo
7) Now restart the send mail service by using the below command. /etc/init.d/sendmail restart
8) Try to send a testmail by using the below command
echo “mail” | mail -s “Hello” abcd@gmail.com
9)Wait for some time and check the mail.