Полезная информация


sendmailSearch this book
Previous: 36.1 Alternative argv[0] NamesChapter 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:

-X           <- Boolean switch
-Xarg        <- switch with argument

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

Table 36.2: Command-Line Switches
-BSection 36.7.1, -BV8.1 and above

Specify message body type

-bSection 36.7.2, -bAll versions

Set operating mode

-baSection 36.7.3, -baNot V8.1- V8.6

Use ARPAnet/Grey Book protocols

-bDSection 36.7.4, -bDV8.8 and above

Run as a daemon, but don't fork

-bdSection 36.7.5All versions

Run as a daemon

-bHSection 36.7.6V8.8 and above

Purge persistent host status

-bhSection 36.7.7, -bhV8.8 and above

Print persistent host status

-biSection 24.5.1All versions

Initialize alias database

-bmSection 36.7.9, -bmAll versions

Be a mail sender

-bpSection 23.4All versions

Print the queue

-bsSection 36.7.11, -bsAll versions

Run SMTP on standard input

-btSection 38.1, "Overview"All versions

Rule testing mode

-bvSection 36.7.13, -bvAll versions

Verify: don't collect or deliver

-bzSection 36.7.14, -bzNot V8

Freeze the configuration file

-CSection 36.7.15, -CAll versions

Location of configuration file

-cSection 34.8.29, HoldExpensive (c)Deprecated

Set HoldExpensive (c) option to true

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

Enter debugging mode

-ESection 36.7.18, -ESony NEWS only

Japanese font conversion

-eSection 34.8.24, ErrorMode (e)DeprecatedSet the ErrorMode (e) option's mode
-FSection 36.7.20, -FAll versionsSet the sender's full name
-fSection 36.7.21, -f and -rAll versions

Set sender's address

-hSection 36.7.22, -hDeprecated

Minimum hop count

-ISection 36.7.23, -IDeprecated

Synonym for -bi

-iSection 36.7.24, -iDeprecated

Set the IgnoreDots (i) option to true

-JSection 36.7.25, -JSony NEWS only

Japanese font conversion

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

Define a macro on the command line

-mSection 34.8.39, MeToo (m)All versions

Set the MeToo (m) option to true

-NSection 36.7.28, -NV8.8 and above

Specify DSN NOTIFY information

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

Don't do aliasing

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

Set a multicharacter option

-oSection 34.1All versions

Set a single-character option

-pSection 36.7.32, -pV8.1 and above

Set protocol and host

-qSection 23.6.1All versions

Process the queue

-RSection 36.7.34, -RV8.8 and above

DSN what to return on a bounce

-rSection 36.7.21Deprecated

Synonym for -f

-sSection 34.8.59, SaveFromLine (f)Deprecated

Set the SaveFromLine (f) option to true

-TSection 34.8.52, QueueTimeout (T)Deprecated

Set QueueTimeout (T) option

-tSection 36.7.38, -tAll versions

Get recipients from message header

-USection 36.7.39, -UV8.8 and above

This is the initial MUA to MTA submission

-VSection 36.7.40, -VV8.8 and above

Specify the ENVID string

-vSection 36.7.41All versions

Run in verbose mode

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

Log transactions

-xSection 36.7.43, -xV8.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.

-Ctest.cf          <- 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] NamessendmailNext: 36.3 List of Recipient Addresses
36.1 Alternative argv[0] NamesBook Index36.3 List of Recipient Addresses