sendmail, newaliases, mailq, smtpd - Sends mail over the Internet
/usr/sbin/sendmail [options] [address...]
Set the body type to type. The current values are 7BIT or 8BITMIME ..
Goes into ARPANET mode. All input lines must end with a CR-LF, and all
messages will be generated with a CR-LF at the end. Also, the From: and
Sender: fields are examined for the name of the sender. Runs as a dae‐
mon. This requires Berkeley Interprocess Communications (IPC). The
sendmail command will fork and run in the background, listening on the
socket specified in the /etc/services file for incoming SMTP (Simple
Mail Transfer Protocol) connections. This is normally run when going
to multiuser mode.
Using this option is equivalent to invoking sendmail as smtpd.
Initializes the alias database. This is the same as invoking
the newaliases command. Delivers mail in the usual way
(default). Prints a listing of the queue. This is the same as
invoking the mailq command. Use the SMTP protocol as described
in RFC821 on standard input and output. This option implies all
the operations of the -ba option that are compatible with SMTP.
Runs in address test mode. This mode reads addresses and shows
the steps in parsing; it is used for debugging configuration
tables. Verifies names only. Does not try to collect or
deliver a message. Verify mode is normally used for validating
users or mailing lists. Uses alternate configuration file. The
sendmail command refuses to run as root if an alternate configu‐
ration file is specified. Sets debugging value to X. A useful
value is 21.n, where n is any nonzero integer less than 100.
This produces information regarding address parsing and is typi‐
cally used with the -bt option. Higher values of n produce more
verbose information. Sets the full name of the sender. Sets
the name of the From: user field (that is, the sender of the
mail). The -f option can only be used by trusted users (normally
root, daemon, and network) or if the person you are trying to
become is the same as the person you are. Sets the hop count to
N. The hop count is incremented every time the mail is pro‐
cessed. When it reaches a limit, the mail is returned with an
error message, the victim of an aliasing loop. If not specified,
Received lines in the message are counted. The maximum hop count
is configurable, but defaults to 30 if you do not configure an
alternate value. The default value is acceptable in most
installations but you may want to increase the value if too many
messages are being lost Defines Macro to have Value. This option
is normally used only from the sendmail daemon command line.
Does not do aliasing or forwarding. Sets option to the speci‐
fied value. This form uses long names. Processing options
specified with -O are described in the Sendmail Installation and
Operation Guide on the Documentation CD-ROM. Sets option X to
the specified value. Processing options specified with -o are
described in the Sendmail Processing Options section later in
this reference page. Set the name of the protocol used to
receive the message. This can be a simple protocol name such as
UUCP or a protocol and hostname, such as UUCP:ucbvax. Processes
saved messages in the queue at given intervals. If time is
omitted, processes the queue once. The time command is given as
a tagged number, with s being seconds, m being minutes, h being
hours, d being days, and w being weeks. For example, -q1h30m or
-q90m would both set the time-out to 1 hour and 30 minutes. If
the time command is specified, the sendmail command will run in
background mode. This option can be used safely with -bd.
Limit processed jobs to those containing substr as a substring
of the queue ID. Limit processed jobs to those containing sub‐
str as a substring of one of the recipients. Limit processed
jobs to those containing substr as a substring of the sender.
An alternate and obsolete form of the -f option. Reads a mes‐
sage for recipients. The To:, Cc:, and Bcc: lines will be
scanned for recipient addresses. The Bcc: line will be deleted
before transmission. Any addresses in the argument list will be
suppressed; that is, they will not receive copies even if listed
in the message header. Goes into verbose mode. Alias expan‐
sions will be announced, and so forth. Log all traffic in and
out of mailers in the indicated log file. This should only be
used as a last resort for debugging mailer bugs. It will log a
lot of data very quickly.
Specifes the mail recipient. You can specify more than one address.
The sendmail command sends a message to one or more recipients, routing
the message over whatever networks are necessary. The sendmail command
does internetwork forwarding as necessary to deliver the message to the
The sendmail command is not intended as a user interface routine. Other
programs provide user-friendly front ends; sendmail is used only to
deliver preformatted messages.
With no options, sendmail reads its standard input up to an End-of-File
or to a line consisting only of a single (dot), and sends a copy of the
message found there to all of the addresses listed. It determines the
network(s) to use based on the syntax and contents of the addresses.
Local addresses are looked up in a file and aliased appropriately.
Aliasing can be prevented by preceding the address with a backslash
(\). Normally the sender is not included in any alias expansions; for
example, if john sends to group, and group includes john in the expan‐
sion, then the letter will not be delivered to john.
For additional information on mail, see the sendmail book by O'Reilly &
Associates and the Sendmail Installation and Operation Guide on the
Sendmail Processing Options
There are a number of optional sendmail processing options that can be
set. Normally, these will be used only by a system administrator.
They can be set either on the command line using the -o option or in
the configuration file. (Refer to the sendmail.cf(4) reference page
for details on the sendmail.cf file.)
The following partial list is limited to those options that are likely
to be useful on the command line. For a complete listing, see the
Sendmail Installation and Operation Guide.
Full pathname to the alias file. The minimum number of free blocks
(bminblocks) needed on the spool filesystem. Sets the blank substitu‐
tion character to the character specified in the Character argument.
The sendmail daemon replaces unquoted spaces in addresses with Charac‐
ter. The supplied configuration file uses a period (.) for Character.
Causes sendmail to queue messages for that mailer daemon without send‐
ing them if an outgoing mailer is marked as expensive to use. The
queue can be run when costs are lower or when the queue is large enough
to send the message efficiently. Sets the delivery mode to x. Delivery
modes are i for interactive (synchronous) delivery, b for background
(asynchronous) delivery, and q for queue only (that is, actual delivery
is done the next time the queue is run). Tries to automatically
rebuild the alias database if necessary. Sets error processing to mode
x. Valid modes are the following: Mails the error message to the
user's mailbox, but always exits with a 0 (zero) exit status (normal
return). Mails the error message to the user's mailbox. Displays the
error message on the terminal (default). Throws away the error message
and returns the exit status only. Writes the error message to the ter‐
minal or mails it if the user is not logged in.
If the text of the message is not mailed by modes m or w and if
the sender is a local user, a copy of the message is appended to
the dead.letter file in the sender's home directory. The mode
to use when creating temporary files. Saves UNIX compatible
style From: lines at the front of messages. Enables GECOS
fuzzy-logic name matching.
The GECOS field is a field in the /etc/passwd file that usually
contains the user's full name. You can modify this information
by using the chfn routine. If sendmail does not find an exact
match for the user name, the Match-GECOS option tries to match
the user name against names in the /etc/passwd file.
For example, if user Jane Q. Public's user name is jpq, she will
receive mail sent to jane if she is the only Jane in the
/etc/passwd file. Likewise, if John Doe's username is jd, he
will receive mail sent to doe if he is the only Doe in the
The sendmail Version 8 command and previous versions of sendmail
differ in how they process GECOS information. If the GECOS
option is enabled, sendmail Version 8 is very stringent; it
requires a match on the entire name. For instance, if the GECOS
field for user jd is "John Doe", then sendmail Version 8 will
only work for mail sent to john doe. An older version of send‐
mail may work with john doe, john, or doe assuming that this is
the only john (or the only doe) in the file. The default group
ID to use when calling mailers. The SMTP help file. Specifies
the maximum hop count.
The maximum hop count option specifies the maximum number of
machines that a mail message can be sent to before it is
rejected. This limit is used to help prevent infinite mail
loops. The default is 30. Depending on the size of your mail
system, you may require a higher or lower minimum hop count.
Does not interpret a . (dot) on a line by itself as a message
terminator. Removes the excess dot inserted by a remote mailer
at the beginning of a line if mail is received through SMTP. In
addition, if receiving mail through SMTP, any dot at the front
of a line followed by another dot is removed. This is the oppo‐
site of the action performed by the X mailer option. Indicate
that sendmail should use the Internet domain name server if it
can. Send error messages in Multipurpose Internet Mail Exten‐
sion (MIME) format. Set connection cache time out. Set connec‐
tion cache size. Specifies the log level to be the value sup‐
plied in the number argument. Each number includes the activi‐
ties of all numbers of lesser value and adds the activity that
it represents. Valid levels and the activities that they repre‐
sent are as follows: Prevents logging. Logs major problems
only. Logs message collections and failed deliveries. Logs
successful deliveries. Logs messages deferred (for example,
because the host is down). Logs messages that are placed in the
queue (normal event). Logs unusual but benign incidents (for
example, trying to process a locked file). Logs the internal
queue ID to external message ID mappings (the default). This can
be useful for tracing a message as it travels between several
hosts. Logs messages that are of interest when debugging. Logs
verbose information regarding the queue. If the sender uses an
alias, and that sender is a member of the group named by the
alias, then also send to the sender. Validates the right-hand
side of alias rewrite rules when the sendmail daemon performs
the newaliases function. If set, this message may have old
style headers. If not set, this message is guaranteed to have
new style headers (that is, commas instead of spaces between
addresses). If set, an adaptive algorithm is used that will cor‐
rectly determine the header format in most cases. Identifies
the person who is to receive a copy of all returned mail.
Selects the directory in which to queue messages. The directory
will be created if it does not exist. The time-out on reads.
If none is set, sendmail will wait forever for a mailer. This
option violates the word (if not the intent) of the SMTP speci‐
fication, so the time-out should probably be fairly large.
The sendmail Version 8 command has additional fine-grained con‐
trol of timeouts. See the Sendmail Installation and Operation
Guide on the Documentation CD-ROM for additional information.
Saves statistics in the named file. Statistics are only col‐
lected if the file exists. This file must be created by the
user. The recommended path for this is /var/adm/sendmail/send‐
mail.st. Statistics can be printed out using /usr/sbin/mail‐
stats. Always instantiates the queue file, even under circum‐
stances where it is not strictly necessary. This provides safety
against system crashes during delivery. Sets the time-out on
undelivered messages in the queue to the specified time. After
delivery has failed (for example, because of a host being down)
for this amount of time, failed messages will be returned to the
sender. The default in the configuration file is 3 days. Sets
the name of the time zone. Sets the default user ID for mail‐
ers. Runs in verbose mode. The sendmail daemon delivers each
message in the mail queue from a separate process. This option
is not required; it can increase system overhead in this envi‐
In aliases, the first character of a name can be a vertical bar to
cause interpretation of the rest of the name as a command to pipe the
mail to. It may be necessary to quote the name to keep sendmail from
suppressing the blanks from between arguments. For example, a file can
contain a common alias such as:
msgs: "|/usr/bin/msgs -s"
Aliases can also have the syntax :include:filename to ask sendmail to
read the named file for a list of recipients. For example, an alias
reads /usr/local/lib/poets.list for the list of addresses making up the
You can also use the Network Information Service (NIS) to distribute
your aliases to other systems.
The sendmail command returns an exit status describing what it did. The
codes are defined in <sysexits.h>: Successful completion on all
addresses. The username was not recognized. A catchall meaning neces‐
sary resources were not available. There is a syntax error in the
address. There is an internal software error, including bad arguments.
There is a temporary operating system error, such as cannot fork. The
hostname was not recognized. The message could not be sent immedi‐
ately, but was queued.
Links to sendmail
Three additional commands are links to sendmail: Prints the contents of
the mail queue. This command is the same as running sendmail with the
-bp option. Builds a new copy of the alias database from the
/var/adm/sendmail/aliases file. This command is the same as running
sendmail with the -bi option. Runs sendmail as a daemon. This command
is equivalent to invoking sendmail with the -bd option.
Mail addresses are based on the domain address (Internet) protocol.
These addresses have the form: email@example.com
Note that the configuration file provided with sendmail specifies that
blanks in addresses be converted to dots before being transmitted.
This convention follows the Internet mail protocol described in RFC822,
but does not match the Internet mail protocol described in RFC733
(NIC41952). You can change this setting by setting the OB option in
the sendmail configuration file (see the sendmail.cf(4) reference
page). A domain is a logical grouping of systems that are connected
together by physical network links. No direct relationship exists
between the actual physical interconnections and the way in which the
systems are grouped in the domain. The domain name identifies a spe‐
cific domain within a larger group of domains. The domain name has the
format of a tree structure. Each node (or leaf) on the tree corresponds
to a resource set, and each node can create and contain new domains
below it. The actual domain name of a node is the path from the root of
the tree to that node.
For example, if node hera is part of the domain OSF, which is in turn a
subdomain of ORG, a message sent to user geo at that address, uses this
The message router (usually sendmail) must determine how to send the
message to its final destination. If the router is at hera, it deliv‐
ers the message to user geo. If the router is at another system within
the OSF domain, it corresponds with the name server for that domain to
find out how to deliver the message. If the router is not a part of the
OSF domain but is in a domain that is under the ORG domain, it corre‐
sponds with the name server for the ORG domain to find out how to
deliver the message. The respective name server returns a network
address to the router. That network address determines the actual path
that the message takes to its destination.
The domain address is read from right to left, with each domain in the
address separated from the next domain by a (dot). This format does not
imply any routing. Thus, although the example is specified as an ORG
address, the message might actually travel by a different route if that
were more convenient or efficient. At one site, the message associated
with the sample address goes directly from the sender to node hera over
a local area network. At another site, it might be sent over a UUCP
network or a combination of other delivery methods.
Normally, the actual routing of a message is handled automatically.
However, you can route the message manually through several specified
hosts to get it to its final destination. An address using intermediate
hosts, called a route address, has the following form:
Explicitly specifying the message routing with these route addresses,
while supported, is strongly discouraged by RFC 1123. Instead, allow
the mail software (for example sendmail) to handle routing issues.
This address specifies that the message goes first to the remote system
represented by hosta, then to the remote system represented by hostb,
and finally to the remote system represented by hostc. This path is
forced even if there is a more efficient route to hostc.
In some cases you may abbreviate the address rather than entering the
entire domain name. In general, systems in the same domain do not need
to use the full domain name. For example, a user on node zeus.XYZ.COM
can send a message to geo@hera.XYZ.COM by entering only geo@hera
because they are in the same local domain, XYZ.COM.
Other mail address formats exist and the mail routing program (send‐
mail) converts most of these other formats to a format that the network
routing system can use. However, if you use the domain address format,
the routing program operates more efficiently.
For example, if sendmail receives an address in the following format:
it converts it to the corresponding domain address format:
Similarly, if sendmail receives an address in the following format:
the mail routing program routes the message directly to the uucp com‐
mand. However, when sending mail via uucp, you must include a route
address that indicates which UUCP host(s) to send the message through
to get to the final destination.
To route messages through the UUCP network, use one of the following
domain address formats. Your choice depends on the way in which the
systems at your site are connected: @system_name.domain_name:uucp-
For example, the address: @zeus:hera!amy
sends a message to user amy on UUCP host hera by way of system
zeus. The address: @apollo.802:merlin!lgh
sends a message to user lgh on UUCP host merlin via system
apollo under the local domain 802. uucp-route:!user-ID@sys‐
In this case, the address: firstname.lastname@example.org
sends a message to user amy on system hera under domain 802 via
the UUCP link merlin through arthur. sys‐
In this example, the address: @apollo.802:mer‐
sends a message to user amy on system hera under domain 802 that
first goes through apollo, the gateway node for domain 802, and
then through the UUCP link merlin through arthur. (Including 802
in this example is optional because the two domain names are
This example is a purely UUCP route address. zeus!hera!kro‐
sends a message to amy on kronos via the UUCP link zeus through
This example, like the previous one, is a purely UUCP route
sends a message to amy on kronos via the UUCP link zeus through
Your host may also be configured to handle DECnet addresses.
Under DECnet Phase IV, an address is of the form nodename::user‐
This is typically converted into a domain-style form, such as
email@example.com (parent-domain is something
such as compaq.com or OSF.ORG that uniquely identifies your com‐
pany). Similarly, your host may also handle Phase V type
addresses, such as joe@dec:.nyc.mars.
By default, the Tru64 UNIX sendmail software uses message encoding that
uses 8 bits of each byte. Although 8-bit encoding better supports the
full range of characters in many non-English languages, 8-bit encoding
is not generally recommended because it violates the SMTP protocol used
for mail transmission over a TCP/IP network.
Specifies the command path. The configuration file. The raw data for
alias names. Sets the option variable A to the full pathname of the
aliases file (/var/adm/sendmail/aliases). This file and the
aliases.dir file comprise the database of alias names. This file and
the aliases.pag file comprise the database of alias names. This file
specifies the users who should receive mail on the local host.
This option is not supported in Tru64 UNIX. The help file. The
collected statistics. The mail queue directory.
Except for /usr/sbin/sendmail and /var/adm/sendmail.cf, the previous
pathnames are all specified in the /var/adm/sendmail.cf file, so they
may vary on your system.
The process id of the daemon.
Commands: mail(1), mailx(1), rc0(8)
Files: aliases(4), forward(4), sendmail.cf(4)
Specifications: RFC819, RFC821, RFC822
Sendmail Installation and Operation Guide
sendmail, Bryan Costales with Eric Allman, O'Reilly & Associates, Inc.