sendmail smarthost


EQ Forum Admin
Staff member
I often prefer to configure sendmail on my servers to smarthost to some other dedicated smtp relay.

On older sendmail systems I would edit /etc/mail/ and configure the line that starts with DS.

On newer sendmail systems the following directions can be used to configure sendmail to relay email to another server such as your company or your ISP's smtp relay servers.

Open the configuration file:

# vi /etc/mail/
Modify the SMART_HOST line:

Update the configuration on the workstation / server:

# m4 /etc/mail/ > /etc/mail/
And then restart sendmail:
# /etc/init.d/sendmail restart
On Solaris servers the paths to the files and commands are a little different.

Here are the directions that work for me on Solaris 10:

Backup your existing configuration file:

# /bin/cp /etc/mail/ /etc/mail/
Edit the template file:

# vi /usr/lib/mail/cf/
Add the following lines after the DOMAIN line:
define(`SMART_HOST', `')
Remove this line if it exists:
define(`confFALLBACK_SMARTHOST', `mailhost$?m.$m$.')dnl
Create the new with this command:

/usr/ccs/bin/m4 /usr/ccs/m4/cf.m4 /usr/lib/mail/cf/ > /etc/mail/
Restart the sendmail service:
/etc/init.d/sendmail stop
/etc/init.d/sendmail start
If you have any problems you can rollback to the original copy of your file.