sendmail(1M)
Requires Optional ARPA Services Software
NAME
sendmail − send mail over the internet
SYNOPSIS
/usr/lib/sendmail [mode] [flags] [address]
newaliases
mailq
DESCRIPTION
Some electronic mail programs (“user agents”) provide front ends for users to create and read mail; other programs (“delivery agents” and “receiving agents”) transport mail between hosts or perform final delivery of local mail. sendmail accepts messages from user agents or receiving agents and routes them to their destinations via the appropriate delivery agents (or “mailers”). In addition, sendmail itself implements a delivery agent and receiving agent for the SMTP protocol running over TCP/IP.
By default, sendmail reads its standard input up to an end-of-file (EOF) or a line containing only a period (.). It then routes copies of the message to all of the recipient addresses on its command line. It determines how to route a message from the syntax and contents of the recipient addresses, according to configuration information in a sendmail configuration file, by default /usr/lib/sendmail.cf.
newaliases, which is the same as /usr/lib/sendmail −bi (see below) builds sendmail’s alias database from a text file, by default /usr/lib/aliases. Local addresses (local user names) are looked up in the alias database and expanded as necessary, unless the user name is preceded by a backslash (\). Normally, the sender is not included in any alias expansions; in other words, if “joe” sends to “group”, and the expansion of “group” includes “joe”, then the letter will not be delivered to “joe”.
Each line of the alias text file must be of the form:
alias : mailing list
Mailing lists can be continued onto multiple lines; each continuation line must begin with white space. A mailing list is a comma-separated list of one or more of the following:
user_name Local user names occurring in alias expansions will themselves be looked up in the alias database unless they are preceded by backslash (‘\’).
remote_address The remote address syntax understood by sendmail is configured in the sendmail configuration file, and typically includes RFC 822 style user@domain and UUCP style host!user.
filename This must be an absolute pathname. sendmail appends a message to the file only if the directory in which it resides is readable and searchable by all, and only if the file already exists, is not executable, and is writable by all.
│ "command line" sendmail pipes the message as standard input to the specified command. Note that the double quotes (") are necessary to protect blanks in the command line.
:include:filename sendmail reads filename for a list of recipient addresses and forwards the message to each.
If a file .forward exists in a user’s home directory and is owned by the user, sendmail redirects mail for that user to the list of addresses in the .forward file. The addresses in .forward and :include: files can be anything that can appear as an address on the right side of an alias in the alias database. Note that the alias database is examined before a recipient’s .forward file. This means that the .forward file is examined only if the recipient does not appear as an alias, or if a local alias resolves to that recipient.
Mail that is temporarily undeliverable is saved in a mail queue. By default, the mail queue is stored in the directory usr/spool/mqueue.
mailq, which is the same as /usr/lib/sendmail −bp, lists the entries in the mail queue. sendmail retries failed deliveries from the queue when called with the −q flag (see below).
sendmail uses syslog(3C) to log a record of its activities. Normally syslogd is configured to log messages from the mail facility in the file /usr/spool/mqueue/syslog. See syslogd(1M). The amount of detail reported can be configured with sendmail’s L option (see below).
MODES
sendmail operates in exactly one of the following modes:
−ba Run in ARPANET mode. This is the same as −bm mode except that all input lines must be terminated with CR-LF, all output lines are terminated with CR-LF, and the “Sender:” and “From:” message header fields are examined for the name of the sender.
−bd Run as the sendmail daemon; run in the background listening for connections on the SMTP port, forking SMTP servers as necessary. Only one sendmail daemon (−bd mode) may be run at one time. Only the super-user is permitted to start the sendmail daemon. Typically the sendmail daemon is also run with the −qinterval flag. See below.
−bi Initialize the alias database. Create a dbm(3x) database from the alias text file, by default /usr/lib/aliases. If this database does not exist, sendmail will not do aliasing. The contents of the alias database can be examined with praliases(1). Only the super-user is permitted to initialize the alias database.
−bk Kill the sendmail daemon. This will kill a daemon started with −bd either with or without the −qinterval flag. It will not kill a queue-processing daemon started only with −qinterval. Only the super-user is permitted to run sendmail −bk.
−bm Route mail from standard input to the recipient addresses following any modes or flags on the command line. This is the default mode.
−bp Print a listing of the mail queue.
−bs Use the SMTP protocol, as described in RFC 821, on standard input. As in −ba mode, all output lines are terminated with CR-LF.
−bt Run in address test mode. In this mode, sendmail reads lines of the form:
ruleset[,ruleset...] address
and rewrites address with the specified rulesets. Address test mode is used for debugging configuration files.
−bv Verify names only; do not try to collect or deliver a message. Verify mode is used to validate users or mailing lists.
−bz “Freeze” the configuration file, to improve performance. This writes sendmail’s data space to the file (by default) /usr/lib/sendmail.fc. If this file exists, future instances of sendmail will read in this pre-interpreted data; otherwise, sendmail must re-interpret the configuration file each time it executes. Only the super-user is permitted to run sendmail −bz. On a cluster, /usr/lib/sendmail.fc is a context dependent file. The script /etc/freeze should be run to freeze the configuration file on each cnode of the cluster (see cdf(4) and freeze(1m)).
FLAGS
sendmail also recognizes the following flags:
−Cfile Use an alternate configuration file. The frozen configuration file, if any, is ignored. If this flag is specified, sendmail will reset its real and effective uid to the real uid of the executing user.
−Ffullname Set the full name of the sender.
−faddress Set the “From” address, in other words, define the sender of the mail. This succeeds only if the address following −f corresponds to the real user executing sendmail, or if the real user is a “trusted user”, defined in the configuration file.
−hN Set the hop count to N. If the hop count is greater than 30, the mail will be returned with the error message too many hops (30 max). By default, sendmail determines the hop count of a message by counting Received header lines in the message.
−n Don’t expand aliases.
−oxvalue Set option x to the specified value. The processing options are described below.
−q[interval] If interval is omitted, process the mail queue once. Otherwise, process the queue at the specified interval. interval is given as a tagged number, where s means seconds, m means minutes, h means hours, d means days, and w means weeks. For example, −q1h30m and −q90m both set the queue processing interval to one hour thirty minutes. Only the super-user is permitted to run the mail queue.
−raddress An alternate and obsolete form of the −f flag.
−t Read the message header to determine recipients. To:, Cc:, and Bcc: header lines are scanned for recipients to send to. The Bcc: line is deleted before transmission. Any addresses in the argument list are suppressed.
−v Run in verbose mode. Alias expansions, connection attempts, SMTP transactions, etc. are logged to standard output.
−Z[file] Use an alternate frozen configuration file. If file is omitted, sendmail uses sendmail.fc in the current working directory. If this flag is specified, sendmail resets its real and effective uid to the real uid of the executing user.
PROCESSING OPTIONS
A number of processing options normally set in the configuration file can also be set on the command line for a particular invocation of sendmail. Options set on the command line override values set in the configuration file. Options that are either “on” or “off” are turned on with −ooptiontrue and turned off with −ooptionfalse. For example, /usr/lib/sendmail −oifalse turns off the “i” option for this run only. Setting any command line options other than d, e, i, L, m, o, r, s, or v, or use of the M option to set a macro other than r or s cause sendmail to reset its real and effective uid to the real uid of the executing user.
Afile Generate or use the alias database based on alternate alias text file file.
c On mailers that are considered “expensive” to connect to, don’t initiate immediate connection; instead, queue the message for later delivery.
dx Set the delivery mode to x. Delivery modes are:
i interactive (synchronous) delivery;
b background (asynchronous) delivery;
q queue only; i.e., expect the messages to be delivered next time the queue is run.
D Automatically rebuild the alias database if it is out of date and if the database files are writable by all.
ex Set error processing to mode x. Valid modes are:
m mail back error messages;
w write(2) an error message to the user’s terminal if the sender is logged in, otherwise mail it back;
p print error messages to standard output (default);
q throw away error messages, only indicating failures by returning a non-zero exit status.
If the text of the message is not mailed back by modes m or w and if the sender is local to this machine, a copy of the message is appended to the file dead.letter (if it exists) in the sender’s home directory.
Fmode The mode to use when creating temporary files.
f Save UNIX-style “From” lines at the front of messages.
gN The default group id to use when calling mailers.
Hfile Use file as the SMTP help file.
I If set, if an MX record lookup or host name lookup fails because the nameserver is not running, sendmail defers the message. If not set, if an MX record lookup fails, sendmail assumes that the nameserver is not being used, and that there are no MX records, and try to connect directly to the host. If a host name lookup fails, sendmail assumes that there is no entry for the host and returns an error.
i Do not interpret a period on a line by itself as a message terminator.
Ln Set log level to n. Log level 10 is usual.
Mxvalue Set the macro x to value. This option can only be used on the command line. The macro w (local host name) is a special case. The value is looked up using gethostbyaddr and w is defined as the canonical host name returned by gethostbyaddr. See gethostent(3N).
m Include the sender in alias expansions.
n If set, parse the right-hand sides of alias definitions when initializing the alias database. In this case, an error in a mailing list is reported when initializing the alias database. However, it may take a long time to initialize a large alias database. If not set, simply store the right-hand sides unexamined. In this case, an error in a mailing list is reported when an attempt is made to mail to it.
o If set, assume that this message can have old-style headers (only spaces between addresses). If not set, assume that the message has new style headers (commas between addresses). If set, an adaptive algorithm is used that correctly determines the header format in most cases.
Paddress Set the Postmaster address. If address is valid, when an undeliverable message is mailed back, a copy of the message header (but not the message body) is delivered to address.
Qdirectory Queue messages in directory. The default is /usr/spool/mqueue.
qN If the load average exceeds the limit set with the x option, N is divided by the difference (plus one) between the current load average and the x limit to determine the maximum priority value (i.e. minimum priority) of messages that will be delivered immediately. Messages with a higher priority value (i.e. lower priority) are queued . The default value of N is 10000.
rtimeout The timeout on reads. If none is set, sendmail will wait forever for a mailer that is not responding. Refer to RFC 1123, “Requirements for Internet hosts Application and Support,” section 5.3.2, for a discussion of SMTP timeouts.
Sfile Specify the file in which to save statistics. The default is /usr/lib/sendmail.st. The saved statistics can be reported with mailstats(1).
s Always instantiate the queue file, even under circumstances where it is not strictly necessary, such as when running in interactive delivery mode.
Ttime Set the timeout on messages in the queue to the specified time. After sitting in the queue for this amount of time, messages are returned to the sender. The default is three days.
uN Set real and effective uid to N when executing mailers. Set real (but not effective) uid to N when running in −bd mode.
v Run in verbose mode.
xN If the current five minute load average is greater than N, use the algorithm described under the q option to determine whether to queue messages rather than deliver them. The default value is 8.
XN If the current five minute load average is greater than N, the sendmail daemon does not accept connections. The default value is 12.
yN The value N is added to the priority of a message (thus lowering its priority) for each recipient. This penalizes messages with large numbers of recipients. The default value is 1000.
Y If set, process each queued message in a separate process. If not set, sendmail keeps track of hosts that are down during queue processing, which may improve performance, but uses more memory.
zN The result of multiplying the message precedence by the value N is subtracted from the message priority, thus favoring higher precedence messages. The default value is 1800.
ZN Each time a message is processed from the queue, the value N is added to the priority of the message, thus penalizing queued messages that are undeliverable for long periods of time. The default value is 9000.
DIAGNOSTICS
sendmail outputs user error messages to standard output if the user attempts to execute sendmail with incorrect or inconsistent arguments or attempts to do something that is not allowed, or if mail delivery fails in error processing mode p. sendmail outputs system error messages both to standard output and to the syslog mail facility to report sendmail configuration errors, system call and other failures (such as inability to open files), failure of programs exec’ed by sendmail, etc. These messages are intended to be self-explanatory.
WARNINGS
sendmail normally runs setuid to root. This is disabled if the −C or −Z flag or certain options are specified on the command line. Therefore, if other than the super-user uses these options, or if sendmail is not running setuid, sendmail may not be able to write to the the queue directory (by default /usr/spool/mqueue) or the alias database files (by default /usr/lib/aliases.dir and /usr/lib/aliases.pag).
Note that in order for sendmail to route mail to filenames, command lines, and :include: specifications (via aliasing only), or to quoted user names (preceded by backslash), the sendmail configuration file must resolve such addresses to the local mailer.
AUTHOR
sendmail was developed by Eric Allman at the University of California, Berkeley.
FILES
Except for /usr/spool/mqueue/syslog, which is configured for syslogd in /etc/syslogd.conf, the following default filenames can be overridden by options in the configuration file or on the command line.
/usr/lib/aliases alias text file
/usr/lib/aliases.pag
/usr/lib/aliases.dir alias data base files
/usr/lib/sendmail.cf configuration file
/usr/lib/sendmail.fc frozen configuration
/usr/lib/sendmail.hf SMTP help file
/usr/lib/sendmail.st collected statistics
/usr/spool/mqueue queue directory
/usr/spool/mqueue/syslog log file
/usr/spool/mqueue/[dqtx]f∗ mail queue
SEE ALSO
mail(1), mailx(1), elm(1), mailstats(1), praliases(1), freeze(1M), syslogd(1M), syslog(3C), dbm(3X), gethostent(3N), cdf(4).
Hewlett-Packard Company — HP-UX Release 8.05: June 1991