Previous Section Next Section

15.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 15-2.

Table 15-2. Command-line switches

Switch

§

Version

Description

-A

-A

V8.12 and above

Specify sendmail.cf versus submit.cf

-B

-B

V8.1 and above

Specify message body type

-b

-b

All versions

Set operating mode

-ba

-ba

Not V8.1- V8.6

Use ARPAnet/Grey Book protocols

-bD

-bD

V8.8 and above

Run as a daemon, but don't fork

-bd

-bd

All versions

Run as a daemon

-bH

-bH

V8.8 and above

Purge persistent host status

-bh

-bh

V8.8 and above

Print persistent host status

-bi

Section 12.5.1

All versions

Initialize alias database

-bm

-bm

All versions

Be a mail sender (the default)

-bP

-bP

V8.12 and above

Print number of messages in the queue

-bp

Section 11.6

All versions

Print the queue

-bs

-bs

All versions

Run SMTP on standard input

-bt

Section 8.1

All versions

Rule-testing mode

-bv

-bv

All versions

Verify: don't collect or deliver

-bz

-bz

Not V8

Freeze the configuration file

-C

-C

All versions

Location of the configuration file

-c

HoldExpensive

(deprecated)

Set HoldExpensive option to true

-d

Section 16.1

All versions

Enter debugging mode

-E

-E

Sony NEWS only

Japanese font conversion

-e

ErrorMode

(deprecated)

Set the ErrorMode option's mode

-F

-F

All versions

Set the sender's full name

-f

-f

All versions

Set sender's address

-G

-G

V8.10 and above

Set gateway submission mode.

-h

-h

(deprecated)

Initial hop count

-I

-I

(deprecated)

Synonym for -bi

-i

-i

(deprecated)

Set the IgnoreDots option to true

-J

-J

Sony NEWS only

Japanese font conversion

-L

-L

V8.10 and above

Syslog label

-M

Section 21.2

V8.7 and above

Define a sendmail macro on the command line

-m

MeToo

Deprecated

Set the MeToo option to true

-N

-N

V8.8 and above

Specify DSN NOTIFY information

-n

Section 12.6

All versions

Don't do aliasing

-O

Section 24.2

V8.7 and above

Set a multicharacter option

-o

Section 24.2

All versions

Set a single-character option

-p

-p

V8.1 and above

Set protocol and host

-q

Section 11.8.1

All versions

Process the queue

-R

-R

V8.8 and above

What DSN info to return on a bounce

-r

-f

(deprecated)

Synonym for -f

-s

SaveFromLine

(deprecated)

Set the SaveFromLine option to true

-T

QueueTimeout

(deprecated)

Set the QueueTimeout option

-t

-t

All versions

Get recipients from message header

-U

-U

V8.8 through V8.11

This is the initial MUA-to-MTA submission

-V

-V

V8.8 and above

Specify the ENVID string

-v

-v

All versions

Run in verbose mode

-X

Section 14.2

V8.1 and above

Log transactions

-x

-x

OSF and AIX 3.x only

Ignored

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 can 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 exceptions to this rule are the -d command-line switch (set debugging mode) and the -q command-line switch (enter queue mode). They cannot 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 can 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/sbin/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 Section Next Section