Setup Sendmail in GNU/Linux

  1. Knowledge Base
  2. Operating System
  3. Systems Administration
  4. Linux
  5. Setup Sendmail in GNU/Linux
Written by my colleague Marshall J. Krinitz
Original Documentation Found Here. 

 GNU/Linux ?

Scope: Set up a general-purpose internetwork routing facility that supports SMTP.

Dependencies

Install these packages first, per your OS:

CentOSUbuntu
yum installapt-get install
sendmail-cfsendmail-cf
mailutilsmailutils
sendmailsendmail

Disable Sendmail daemon

Improve Sendmail security by turning it off.

systemctl stop sendmail

systemctl disable sendmail

Preflight checks

You’ll need these.

  • Check for required files:

ls /etc/mail/submit.*

should yield:

/etc/mail/submit.cf

/etc/mail/submit.mc

  • Check for m4 processor:

which m4

should yield:

/usr/bin/m4

Build submit.cf file

The secret sauce.

  • Backup submit.cf:

cp -v /etc/mail/submit.cf /etc/mail/submit.cf.bak

  • Create mysubmit.mc macro configuration file by copying default macro configuration file:

cp -v submit.mc mysubmit.mc

  • Modify mysubmit.mc,

replacing:

[127.0.0.1]

with:

mailhost

on the msp line so that is looks like this:

FEATURE(`msp', `mailhost')dnl`
  • Commit your change (from /etc/mail):

m4 mysubmit.mc > /etc/mail/submit.cf

Modify /etc/hosts file

More goodness.

  • List the host’s IP & hostname, e.g.:

127.0.1.1 foobar.psych.nyu.edu foobar foo

  • List an SMTP client (choose 1):

216.165.47.33 smtp.nyu.edu nyu mailhost

128.122.112.26 calaf.cns.nyu.edu calaf mailhost

Leave a Reply

Your email address will not be published. Required fields are marked *