Setting up ✉️ Sendmail better method

Setting up ✉️ Sendmail better method

To generate a sendmail configuration file you must edit the file /etc/mail/ (make a copy of it first for future reference). This file is used to generate the file which is the main sendmail configuration file.

Redhat (and other Linux vendors) will have already created the file /etc/mail/ file and filled it with sensible default values. You will need to modify the following lines, change the line:

dnl define(`SMART_HOST',`smtp.your.provider')



The dnl is used to signify a comment, which means everything after the dnl will be ignored, therefore after setting the SMART_HOST variable you should remove the dnl from the start of the line.

The only other change you need to make to this file is to comment out the line:

DAEMON_OPTIONS(`Port=smtp,Addr=, Name=MTA')dnl

by placing a dnl at the start of the line:

dnl DAEMON_OPTIONS(`Port=smtp,Addr=, Name=MTA')dnl

This line makes sendmail only accept e-mail to and from the local machine. To accept e-mail from other machines on the Internet the line should be removed, which is done by commenting it out.

You can now generate your new file. To do this issue the command (as root):

m4 >

This will create the sendmail configuration file. It should be placed in the /etc/mail/ directory (or the /etc/ directory for older Linux distributions). You can now start sendmail with the command (as root):

/etc/rc.d/init.d/sendmail restart

(some Linux distributions will use different commands to this).

Stefan Pejcic
Join the discussion

I enjoy constructive responses and professional comments to my posts, and invite anyone to comment or link to my site.