Ordinarily, whenever sendmail executes a program via the prog delivery agent, it does so from within the sendmail queue directory. One unfortunate side effect of this behavior is that shell scripts written with the C shell (and possibly other programs) can fail because they cannot stat(2) the current directory. To alleviate this problem, V8 sendmail introduced the D= delivery agent equate. This equate allows you to specify a series of directories for sendmail to attempt to chdir(2) into before invoking the delivery program.

The form of the D= delivery agent equate looks like this:


The D= is followed by a colon-separated series of directory pathnames. Before running the delivery program, sendmail tries to chdir(2) into each in turn, leftmost to rightmost, until it succeeds. If it does not succeed with any of the directories (perhaps because none of them exists), sendmail remains in its queue directory.

One recommended setting for the D= delivery agent equate is this:


Here, sendmail first tries to chdir(2) into the directory defined by the $z sendmail macro ($z). That macro either contains the full pathname of the recipient’s home directory or is NULL. If it is NULL or if the home directory is unavailable, the chdir(2) fails, and sendmail instead does a chdir(2) to the / (root) directory.

In using V8 sendmail’s mc configuration, the value given to D= can be easily changed only for the prog delivery agent, which defaults to:


For prog it can ...

Get Sendmail, 3rd Edition now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.