-D

Write debugging output to a file V8.13 and later

The -D command-line switch causes sendmail to redirect sendmail’s debugging output (The Syntax of -d on page 530) into a file for later examination. It is used like this, where file is the name of an existing or new file:

-D file

The -D command-line switch (if used) must precede all -d switches on the same command line. Otherwise, the following error will print and all debugging output will be printed to the standard output (possibly causing you to miss seeing the error):

-D file must be before -d

The file specified with -D must live in a directory that is writable by the user running sendmail. If the file does not exist, it will be created. If the file already exists, it will be silently appended to.

Extra care must be exercised when using the -D command-line switch when sendmail is run as root because the target file will be appended to, even if it is a symbolic link to an important file. For example, when /tmp/foo is a non-root owned symbolic link that points to /etc/passwd, the following command line, when run by root, will silently append debugging information to the /etc/passwd file:

# /usr/sbin/sendmail -D /tmp/foo -d0.1 -bt < /dev/null

Get sendmail, 4th Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.