Tải bản đầy đủ
[Appendix E] E.2 The sendmail Command

[Appendix E] E.2 The sendmail Command

Tải bản đầy đủ

[Appendix E] E.2 The sendmail Command


Verify addresses; don't collect or deliver mail.
Initialize the alias database.
Print the mail queue.
Process queued mail. Repeat at interval time.
Use file as the configuration file.
Set debugging level.
Set option x to the specified value.
Ignore dots in incoming messages.
Send to me, too.
Run in verbose mode.
Alternate form of -f.

Several of the command-line arguments are covered in Chapter 10. These are:
Allows trusted users to override the sender address on outgoing messages. For security reasons,
it is disabled on some systems. Obsolete alternative forms of this argument are -r and -s.
Reads the To:, Cc: and Bcc: headers from standard input. Used to send a file that contains these
headers or when typing in a test message, as in Chapter 10.
Runs sendmail in background mode, causing it to collect incoming mail. Use this argument on
the sendmail command in the boot script.
Used to test sendmail address rewrite rules.
Initializes the aliases database. This is the same as the newaliases command covered in Chapter
Sets the time interval at which the mail queue is processed. Use on the sendmail command in
the boot script.
Loads an alternative sendmail configuration file. Use this to test the configuration before
moving the new file to sendmail.cf.
file:///C|/mynapster/Downloads/warez/tcpip/appe_02.htm (2 of 5) [2001-10-15 09:19:29]

[Appendix E] E.2 The sendmail Command

Permits you to view the exchange of SMTP commands in real time.
Verifies address processing without actually sending mail.
Other than the two arguments (-bd and -q) used on the sendmail command line in the boot script to
process incoming mail, the most common use for sendmail arguments is debugging. From the list
above, -bt, -C, -bv, -v, and -t are all used in Chapter 10 in debugging examples. Other debugging
arguments are:
Prints a list of mail that is queued for delivery. It is the same as the mailq command. Mail is
queued when it cannot be delivered immediately because the remote host is temporarily unable
to accept the mail. sendmail periodically processes the queue, based on the time interval you set
with the -q argument, and attempts to deliver the mail in the queue. The queue can grow large
enough to impede sendmail's performance if an important remote host is down. mailq shows
how many items are queued as well as the source and destination of each piece of mail.
When the queue requires immediate processing, invoke sendmail using -q with no time
interval. This processes the entire queue. Some variations of the -q argument allow you to
selectively process the queue. Use -qIqueue-id to process only those queue entries with the
specified queue identifier; -qRrecipient to process only items being sent to the specified
recipient; or -qSsender to process only mail sent from the specified sender. The mailq
command displays the queue identifier, sender address, and recipient address for every item in
the queue.
Sets a sendmail option for this one instantiation of sendmail, e.g., -oA/tmp/test-aliases. Use
this argument to test alternative option settings without editing the sendmail.cf file. -o uses the
old sendmail option syntax. An alternate form of the argument is -O, which uses the new option
syntax, e.g., -OAilasFile=/tmp/test-aliases. See sendmail Options later in this Appendix.
Sets the level of detail displayed when debugging sendmail code. Can be used to debug rewrite
rules, e.g., sendmail -bt -d21.12. Otherwise -d is only useful for sendmail source code
Sets the counter used to determine if mail is looping. By default, it is set to 30, which is a good
operational value. When you are debugging a mail loop problem, set the hop count lower, e.g., h10, to reduce the number of times a piece of mail is handled by the system. Otherwise, leave
this value alone.

file:///C|/mynapster/Downloads/warez/tcpip/appe_02.htm (3 of 5) [2001-10-15 09:19:29]

[Appendix E] E.2 The sendmail Command

The remaining arguments are rarely used on the command line:
Indicates the MIME message body type. Acceptable values are either 7BIT or 8BITMIME.
Requests that the sender be notified of the delivery status of the mail. The default value is
FAILURE, DELAY, which notifies the sender when mail delivery fails or is delayed in the
queue. Other acceptable values are NEVER, to request that no status notifications be returned
to the sender, and SUCCESS, to request notification of successful mail delivery.
Sets a macro value for this instantiation of sendmail. For example, -MMnuts.com sets macro
M to nuts.com.
Sets the sending protocol and the sending host. This is equivalent to setting the internal s and r
macros. If a system has more than one external mail protocol, for example, UUCP and SMTP,
this forces the system to use a specific protocol for this piece of mail.
Sets the amount of information returned to the sender when a message cannot be delivered.
This can be either HDRS for headers-only or FULL for the headers and the full message body.
Indicates that this mail comes directly from a user interface and was not forwarded from a
remote mail handler. At this writing this argument is not yet used, but in the future user agent
programs may include it when they pass mail to sendmail.
Inserts an "envelop id" into the outbound message that is returned if message delivery fails.
Logs all mail messages to the specified log file. This rapidly produces an enormous log file.
Disables the processing of aliases and mail forwarding.
Tells sendmail to deliver mail, which it will do anyway.
Reads the header From: line to find the sender. Uses three digit reply codes, and ends error
lines with . This is an obsolete argument.
file:///C|/mynapster/Downloads/warez/tcpip/appe_02.htm (4 of 5) [2001-10-15 09:19:29]

[Appendix E] E.2 The sendmail Command

Tells sendmail to use SMTP for incoming mail. When appropriate, sendmail will do this even
without the -bs argument.
Normally, an SMTP message terminates when a line containing only a dot is encountered. This
argument tells sendmail to ignore the dots in incoming messages.
Sends a copy of the mail to the person sending the mail. Normally this is done with a CC: or
BCC: header in the message, not with the -m argument.
This is a complete list of sendmail command-line arguments at this writing. Some of these arguments
were introduced in sendmail 8. Others are considered obsolete in sendmail V8. Check the manpage for
your system to find out exactly what arguments are available on your system.
When the sendmail command is executed, it reads its configuration from the sendmail.cf file. A basic
sendmail.cf file can be built from m4 macros that come with the sendmail source code. Chapter 10
provides examples of how this is done. The next section provides a complete list of the m4 macros that
come with the sendmail distribution.

Previous: E.1 Compiling
E.1 Compiling sendmail

TCP/IP Network
Book Index

Next: E.3 m4 sendmail
E.3 m4 sendmail Macros

[ Library Home | DNS & BIND | TCP/IP | sendmail | sendmail Reference | Firewalls | Practical Security ]

file:///C|/mynapster/Downloads/warez/tcpip/appe_02.htm (5 of 5) [2001-10-15 09:19:29]

[Appendix E] E.3 m4 sendmail Macros

Previous: E.2 The sendmail

Appendix E
A sendmail Reference

Next: E.4 More sendmail.cf

E.3 m4 sendmail Macros
The sendmail distribution comes with several sample configuration files. Chapter 10 provides an
example of how the tcpproto.mc file is modified to produce a configuration file suitable for a Linux
system. The prototype files are m4 macro configuration files that produce useable sendmail.cf files as
output. The prototype files are located in the sendmail/cf/cf directory of the sendmail distribution. All
of the m4 macro configuration files end with the .mc file name extension. The .mc files can be
composed of the following m4 macros: [1]
[1] The macro commands are listed in the order they would occur in the configuration
Defines the version number of the .mc source file. RCS or SCCS version numbers are
commonly used. This command is optional.
Points to the m4 source file that contains the operating system-specific information for this
configuration. This is required.
Points to the m4 source file that contains configuration information specific to this domain.
This is optional.
Points to an m4 source file that defines an optional sendmail feature. This is not required for
m4 to process the .mc source file, but many configurations have multiple FEATURE entries.
Points to an m4 source file that contains site-specific configuration information. This is a
temporary configuration used to fix a temporary problem. The use of HACKS is discouraged.

file:///C|/mynapster/Downloads/warez/tcpip/appe_03.htm (1 of 21) [2001-10-15 09:19:31]

[Appendix E] E.3 m4 sendmail Macros

Points to a source file that contains m4 SITE commands that define the UUCP sites connected
to this host. The format of the command is: SITECONFIG(file, local-hostname, class), which
reads the UUCP hostnames from file into class.
Defines a local value. Most "defines" are done in the m4 source files that are called by the .mc
file, not in the .mc file itself. It can define a value for a sendmail.cf macro, option, or other
Points to an m4 source file that contains the configuration commands that define a sendmail
mailer. A least one MAILER command must appear in the configuration file. Generally more
than one MAILER command is used.
Heads a section of code to be added to ruleset n, where n is 0, 1, 2, or 3. The code that follows
the LOCAL_RULE_n command is composed of standard sendmail.cf rewrite rules. [2] The
LOCAL_RULE_n command is rarely used.
[2] The one exception to this is the UUCPSMTP macro that can be used in the local
rule. See the New sendmail Configuration Files document that come with the sendmail
V8 distribution if you have questions about UUCP configuration.
Heads a section of code to be added to the sendmail.cf file after the local information section
and before the rewrite rules. The section of code contains standard sendmail.cf configuration
commands. This macro is rarely used.
Most of the macros in the .mc file point to other m4 source files. The macro names OSTYPE,
DOMAIN, FEATURE, MAILER, HACKS, and SITECONFIG are all names of subdirectories within
the sendmail/cf directory. The value passed to each of these macros is the name of a file within the
specified directory. For example, the command FEATURE(nouucp) tells m4 to load the file
nouucp.m4 from the feature directory and process the m4 source code found there. The real meat of
the sendmail configuration is contained in the source files pointed to by the OSTYPE, DOMAIN,
FEATURE, and MAILER commands.
The macro commands HACK, SITECONFIG, LOCAL_RULE_n, and LOCAL_CONFIG are rarely
used in a macro configuration file. To simplify this appendix, we do not mention them again. [3]
Likewise, for the sake of simplicity we avoid discussing UUCP configuration and concentrate on
SMTP. Still, m4 configuration can appear to be enormously complex. Please remember that this
appendix is a reference, and as such lists as many of the m4 macros as possible. Most of these you
will never need to use. Refer to Chapter 10 for a realistic example of how m4 is used to build a
sendmail.cf file.

file:///C|/mynapster/Downloads/warez/tcpip/appe_03.htm (2 of 21) [2001-10-15 09:19:31]