The Behavior of -d

When sendmail is given the -d debugging switch, it internally performs three distinct actions. First, if the category.level is omitted, sendmail presets all categories, 0-99 inclusively, to a level of 1. It then sets the categories in the command line (if any) to the corresponding levels specified (or to 1 if no level is specified). Finally, it calls setbuf(3) to place the standard output in unbuffered mode.

Setting categories 0-99 to a level of 1 has two side effects:

  • Usually, certain errors are not reported because they are tolerable, but a level of 1 generally causes those otherwise missing error messages to be printed. For example, if the aliases file is missing, sendmail does not perform aliasing but is silent about it. A category 27 level of 1, on the other hand, causes sendmail to print the reason it could not open the aliases file.

  • Because sendmail is usually silent about what it is doing, any debugging at all causes it to print a great deal of information about what it is trying to do and what it has done.

Note, however, that debugging should generally not be used in combination with any -bd, -bD, or -bs command-line switch. Debugging output can interfere with normal SMTP transactions, and thus can corrupt the transmission or receipt of SMTP email. Use these debugging switches only when you are absolutely certain that no actual mail will be impacted (as might be the case on a machine that normally does not receive mail).

Get Sendmail, 3rd 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.