How To Configure sendmail’s Smart Relay Host

To configure a Solaris server’s smart relay host, most people will simply edit the DS entry in /etc/mail/ and leave it at that. Let’s assume that smtp is the name of the smart relay host. By adding the string ‘smtp$?m.$m$.’ in – ‘$?m.$m$.’ is sendmail’s way of representing the server’s domain name – and after restarting the sendmail daemon, e-mails will get relayed to the host smtp. The problem with this approach is if somebody came along and did things the “right” way, all changes that were made directly to will be wiped away.

# "Smart" relay host (may be null)

A Solaris admin worth the name will never do the above. is the compiled output of another file which by convention can be found in /etc/mail/cf/cf. Initially, this file is named But the first thing a good Solaris admin will do is to make a copy of the file and call it <hostname>.mc, where hostname is the output of the command /usr/bin/hostname.

# cd /etc/mail/cf/cf
# cp -p `hostname`.mc

Now, edit <hostname>.mc and add this line.

define(`SMART_HOST', `smtp$?m.$m$.')

Replace the string ‘smtp’ with the name of the server that relays e-mails; i.e. the smart relay host, in your organisation.

Save the file and compile it.

# /usr/ccs/bin/make `hostname`.cf
test ! -f || /usr/bin/mv
/usr/ccs/bin/m4 ../m4/cf.m4 >
# ls -l `hostname`.cf
-rw-r--r--   1 root     root       40283 Oct 31 11:14

Copy the <hostname>.cf file over /etc/mail/ and restart the sendmail daemon.

# cp /etc/mail/
# svcadm restart svc:/network/smtp:sendmail
# svcs /network/smtp:sendmail
STATE          STIME    FMRI
online         11:30:20 svc:/network/smtp:sendmail