'ErrorMode'' ''''


Specify mode of error handling All versions

The sendmail program is flexible in its handling of delivery errors. By selecting from five possible modes with the ErrorMode option, you can tailor notification of delivery errors to suit many needs.

This option is intended primarily for use from the command line. If included in the configuration file, it should be given only a p or m argument, for print mode (the default) or mail-error mode.

The forms of the ErrorMode option are as follows:

O ErrorMode=mode             configuration file (V8.7 and later) 
-OErrorMode=mode             command line (V8.7 and later) 
define(`confERROR_MODE',mode)    mc configuration (V8.7 and later) 
-emode                       command-line shorthand (not recommended) 
Oemode                       configuration file (deprecated) 
-oemode                      command line (deprecated) 

The type of mode is character. If mode is missing, the default value is p (for print normally). If this ErrorMode option is entirely missing, the default value is p.

The possible characters for the mode argument are listed in Table 24-20.

Table 24-20. ErrorMode option modes





See this section

Like m, but always exit with a zero exit status


See this section

Mail error notification to the sender no matter what


See this section

Print error messages (the default)


See this section

Remain silent about all delivery errors


See this section

Write errors to the sender's terminal screen

Note that the error-handling mode is automatically set to m (for mail errors) in three special circumstances. First, if a mailing list is being processed and if an owner is found for that list (Section 13.3), the mode is set to m to force mail notification to that owner. Second, if SMTP delivery is to multiple recipients, the mode is set to m to force mail notification to the sender on the assumption that multiple recipients qualify as a mailing list. And third, if the sender address is not that of a local sender, the notification must be mailed to the offsite address.

Also note that V8 sendmail sets the error-handling mode to q (for quiet) when sendmail is given the -bv (address verification) command-line switch. This prevents spurious error messages from being mailed to root when testing addresses.

The ErrorMode option is safe. Even if it is specified from the command line, sendmail retains its special privileges.


Like m, but always exit with a zero exit status. This mode is intended for use from the command line under very limited circumstances. This e mode is used by the rmail(8) program when it invokes sendmail. On some systems, if sendmail exits with a nonzero value (fails), the uuxqt(8) program sends its own error message. This results in two error messages being sent, whereas only one should ever be sent. Worse still, the error message from uuxqt might contain a bad address, one that can itself bounce.


Mail error notification to the sender, no matter what. This mode tries to find the most rational way to return mail. All aliasing is disabled to prevent loops. Nothing is ever saved to ~/dead.letter. This mode is intended for use from the command line. The m mode is appropriate for mail generated by an application that arises from a login but for which no human is present to monitor messages. One example might be a data-acquisition system that is manually logged in but is then left to fend for itself. Similarly, when the user news sends articles by mail, error messages should not be placed in ~news/dead.letter, where they might be overlooked; rather, this mode should be used so that errors are placed in a mail spool file, where they can be periodically monitored.


Print error messages (the default). The sendmail program simply tries to save a copy of the failed mail in ~/dead.letter and prints an error message to its standard output. If the sender is remote, it sends notification of the problem back to that sender via email. If ~/dead.letter is not writable, a copy is saved to /usr/tmp/dead.letter. Note that this default path was hard-coded into pre-V8 versions of sendmail as a string constant. The only way to change it was by editing savemail.c. But beginning with V8 and prior to V8.10 sendmail, the path component was defined by the _PATH_VARTMP definition, and that could be tuned in your Makefile. Beginning with V8.10 sendmail, this path is defined with the DeadLetterDrop option (DeadLetterDrop).


Quiet; remain silent about all delivery errors. If the sender is local, this mode assumes that the program or person that ran sendmail will give notification of the error. Mail is not sent, and ~/dead.letter is not saved. Error information is provided only in the sendmail program's exit(2) status (Section 15.5). This mode is intended for use in shell scripts. One possible use might be exploding a junk-mail mailing list with a program that could correctly interpret the exit status.


Write errors to the sender's terminal screen if logged in (similar to write(1)); otherwise, send mail to that user. First tries to write to stdout. If that fails, it reverts to mail notification. This mode is intended for use from the command line. The reason for this mode has been lost to history,[31] and it should be considered obsolete.

[31] According to Eric Allman, "Dubious, someone bugged me for it; I forget why."

    Part I: Build and Install
    Part II: Administration
    Part III: The Configuration File
    Chapter 21. The D (Define a Macro) Configuration Command
    Chapter 24. The O (Options) Configuration Command