Linux Configure Sendmail as SMTP Mail Client ( submission MTA )

Sendmail can be configured as an SMTP mail client, also known as a submission MTA (Mail Transfer Agent), on Linux systems. Here are the general steps to set up Sendmail as an SMTP mail client on Linux:

  1. Install Sendmail: Sendmail is usually available in the default repositories of most Linux distributions. You can install Sendmail by running the following command as root or with sudo privileges:
sudo yum install sendmail

OR

sudo apt-get install sendmail
  1. Configure Sendmail to use SMTP: Edit the Sendmail configuration file /etc/mail/sendmail.mc and add the following lines at the end of the file:
define(`SMART_HOST',`smtp.gmail.com')dnl
define(`RELAY_MAILER_ARGS', `TCP $h 587')dnl
define(`ESMTP_MAILER_ARGS', `TCP $h 587')dnl
define(`confAUTH_OPTIONS', `A p')dnl
TRUST_AUTH_MECH(`EXTERNAL DIGEST-MD5 CRAM-MD5 LOGIN PLAIN')dnl
define(`confAUTH_MECHANISMS', `EXTERNAL GSSAPI DIGEST-MD5 CRAM-MD5 LOGIN PLAIN')dnl

Note: Replace smtp.gmail.com with the hostname of your SMTP server.

  1. Regenerate Sendmail configuration: After making changes to the Sendmail configuration file, you need to regenerate the Sendmail configuration by running the following command:
sudo m4 /etc/mail/sendmail.mc > /etc/mail/sendmail.cf
  1. Restart Sendmail service: To apply the changes, restart the Sendmail service by running the following command:
sudo systemctl restart sendmail
  1. Test Sendmail configuration: You can test the Sendmail configuration by sending a test email using the mail command. For example, to send an email to user@example.com, run the following command:
echo "This is a test email." | mail -s "Test email" user@example.com

Note: Make sure that the recipient’s email address is valid and the SMTP server you are using allows relaying from your IP address.

That’s it! With the above steps, you can configure Sendmail as an SMTP mail client (submission MTA) on Linux. (www.ameriseed.net)

Leave a Comment