Creating an m4 DOMAIN File:
The domain directory is intended for m4 source files that contain information specific to your
domain. This is a perfect place to put the commands that rewrite the hostname to the domain name
on outbound mail, so we create a new m4 macro file in the domain directory and call it foobirds.m4
.
We begin by changing to the ../domain
directory and copying the file generic.m4
to foobirds.m4
to
act as a starting point for the configuration. The listing below shows these steps.
# cd /usr/share/sendmail-cf/domain
# cp generic.m4 foobirds.m4
# chmod 644 foobirds.m4
# tail -6 foobirds.m4
VERSIONID(`$Id: generic.m4,v 8.15 1999/04/04 00:51:09 ca Exp $')
define(`confFORWARD_PATH', `$z/.forward.$w+$h:$z/.forward+$h
Ä:$z/.forward.$w:$z/.
forward')dnl
define(`confMAX_HEADERS_LENGTH', `32768')dnl
FEATURE(`redirect')dnl
FEATURE(`use_cw_file')dnl
EXPOSED_USER(`root')
After copying generic.m4
to foobirds.m4
, use the chmod command to set the file access
permissions for the new file. (On some systems, the files in the domain directory are read-only.)
Make the file read and write for the owner, and read-only for the group and the world.
The tail command displays the last six lines in the newly created foobirds.m4 file
. (All of the lines
before this are comments that are of no interest for this discussion.) You have already seen the
VERSIONID macro. The first new line is the macro that defines confFORWARD_PATH, which tells
sendmail where to look for the user's .forward file. The $z and the $w sendmail variables were
described earlier in the discussion of the sendmail.cf
ForwardPath option, which contained the two
paths $z/.forward.$w:$z/.forward. Those two paths are the default value for confFORWARD_PATH.
The define in the previous listing increases the complexity of the.forward path list by adding the value
$z/.forward.$w+$h:$z/.forward+$h to the default search list. The $z and $w variables serve the
same purpose as before. The $h variable contains the detail value when the user+detail addressing
syntax is used, and procmail is used as the local mailer. We know that procmail is being used as the
local mailer from the local_procmail feature in the linux.m4
OSTYPE file. Given this specific
configuration, local mail on a host named egret addressed to craig+tux would prepend the
following. forward search path to the standard path:/home/craig/.forward.egret+tux:/home/craig/.forward+tux. Even though user+detail addressing is rarely
used, we decide to keep this define in the configuration because we plan to use procmail as the
local mailer.