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.

admin

Our team has expertise across software and web development, WordPress, e-commerce, mobile applications, UI/UX, cloud and infrastructure, DevOps, CI/CD, API integration, security, testing, automation, and technical support. The team also works with AI-based software solutions, LLMs, AI workflows, AI agents, and intelligent application development to help businesses automate processes and build smarter digital solutions. We focus on developing, deploying, maintaining, and optimising secure, scalable, and reliable technology solutions while helping businesses adopt modern technologies and drive digital transformation.

Leave a Reply

Scroll to Top