home | O'Reilly's CD bookshelfs | FreeBSD | Linux | Cisco | Cisco Exam  


sendmailSearch this book
Previous: 36.1 Alternative argv[0] Names Chapter 36
The Command Line
Next: 36.3 List of Recipient Addresses

36.2 Command-Line Switches

Command-line switches are command-line arguments that begin with a - character, and precede the list of recipients (if any). The forms for command-line switches, where X is a single letter, are:


<- Boolean switch


<- switch with argument

All switches are single letters. The complete list is shown in Table 36.2 .

Table 36.2: Command-Line Switches
Switch Version Description
-B Section 36.7.1, -B V8.1 and above

Specify message body type

-b Section 36.7.2, -b All versions

Set operating mode

-ba Section 36.7.3, -ba Not V8.1- V8.6

Use ARPAnet/Grey Book protocols

-bD Section 36.7.4, -bD V8.8 and above

Run as a daemon, but don't fork

-bd Section 36.7.5 All versions

Run as a daemon

-bH Section 36.7.6 V8.8 and above

Purge persistent host status

-bh Section 36.7.7, -bh V8.8 and above

Print persistent host status

-bi Section 24.5.1 All versions

Initialize alias database

-bm Section 36.7.9, -bm All versions

Be a mail sender

-bp Section 23.4 All versions

Print the queue

-bs Section 36.7.11, -bs All versions

Run SMTP on standard input

-bt Section 38.1, "Overview" All versions

Rule testing mode

-bv Section 36.7.13, -bv All versions

Verify: don't collect or deliver

-bz Section 36.7.14, -bz Not V8

Freeze the configuration file

-C Section 36.7.15, -C All versions

Location of configuration file

-c Section 34.8.29, HoldExpensive (c) Deprecated

Set HoldExpensive (c) option to true

-d Section 37.1, "The Syntax of -d" All versions

Enter debugging mode

-E Section 36.7.18, -E Sony NEWS only

Japanese font conversion

-e Section 34.8.24, ErrorMode (e) Deprecated Set the ErrorMode (e) option's mode
-F Section 36.7.20, -F All versions Set the sender's full name
-f Section 36.7.21, -f and -r All versions

Set sender's address

-h Section 36.7.22, -h Deprecated

Minimum hop count

-I Section 36.7.23, -I Deprecated

Synonym for -bi

-i Section 36.7.24, -i Deprecated

Set the IgnoreDots (i) option to true

-J Section 36.7.25, -J Sony NEWS only

Japanese font conversion

-M Section 31.2, "Command-Line Definitions" V8.7 and above

Define a macro on the command line

-m Section 34.8.39, MeToo (m) All versions

Set the MeToo (m) option to true

-N Section 36.7.28, -N V8.8 and above

Specify DSN NOTIFY information

-n Section 24.6, "Prevent Aliasing with -n" All versions

Don't do aliasing

-O Section 34.1, "Command-Line Options" V8.7 and above

Set a multicharacter option

-o Section 34.1 All versions

Set a single-character option

-p Section 36.7.32, -p V8.1 and above

Set protocol and host

-q Section 23.6.1 All versions

Process the queue

-R Section 36.7.34, -R V8.8 and above

DSN what to return on a bounce

-r Section 36.7.21 Deprecated

Synonym for -f

-s Section 34.8.59, SaveFromLine (f) Deprecated

Set the SaveFromLine (f) option to true

-T Section 34.8.52, QueueTimeout (T) Deprecated

Set QueueTimeout (T) option

-t Section 36.7.38, -t All versions

Get recipients from message header

-U Section 36.7.39, -U V8.8 and above

This is the initial MUA to MTA submission

-V Section 36.7.40, -V V8.8 and above

Specify the ENVID string

-v Section 36.7.41 All versions

Run in verbose mode

-X Section 26.4, "Log Transactions with -X" V8.1 and above

Log transactions

-x Section 36.7.43, -x V8.2 and above


Some switches are called Boolean because they are either true or false. The -v switch, for example, is Boolean because it puts sendmail into verbose mode if it is present (true). If it is absent (false), sendmail does not run in verbose mode.

Some switches take arguments. The -C switch, for example, tells sendmail where to find its configuration file. When a switch takes an argument, the argument may immediately follow the letter or be separated from it with whitespace: [2]

[2] Prior to V8 sendmail , whitespace was not allowed between the letter and the argument.

<- good

-C test.cf         
<- also good

The only exception to this rule is the -d command-line switch (set debugging mode). It may not have whitespace between the letter and the arg .

Some switches, such as -q (process the queue), can either be Boolean or take an argument:

-q                 <- boolean
-q1h               <- with argument

The position of switches in the command line is critical. If any follow the list of recipients, they are wrongly taken as mail addresses and lead to bounced mail. But the order in which switches appear prior to the recipients is not important. That is, they may appear in any order without changing the behavior of sendmail .

An undefined switch letter causes the following error to be printed and sendmail to immediately exit:

sendmail: illegal option - 
bad letter here

The special switch -- can be used to delimit the switches from the list of recipients:


/usr/lib/sendmail -- -jim

Here, the recipient is -jim . To prevent the - of -jim from being wrongly interpreted as indicating a switch, the special switch -- is used to mark the end of all switches. [3]

[3] Under pre-V8 sendmail , recipient names could never begin with a -C , -b , -d , -q , or -Z . If any did, they were wrongly interpreted as switches during preprocessing.

Previous: 36.1 Alternative argv[0] Names sendmail Next: 36.3 List of Recipient Addresses
36.1 Alternative argv[0] Names Book Index 36.3 List of Recipient Addresses