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 ..
-ba 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.
-bd Runs as a daemon. 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 incom-
ing 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.
-bi Initializes the alias database. This is the same as invoking the
-bm Delivers mail in the usual way (default).
-bp Prints a listing of the queue. This is the same as invoking the mailq
-bs Use the SMTP protocol as described in RFC821 on standard input and out-
put. This option implies all the operations of the -ba option that are
compatible with SMTP.
-bt Runs in address test mode. This mode reads addresses and shows the
steps in parsing; it is used for debugging configuration tables.
-bv 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 configuration file is specified.
-dX 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 typically 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.
-hN Sets the hop count to N. The hop count is incremented every time the
mail is processed. 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.
-n Does not do aliasing or forwarding.
Sets option to the specified value. This form uses long names. Pro-
cessing options specified with -O are described in the Sendmail Instal-
lation 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
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
Limit processed jobs to those containing substr as a substring of one
of the recipients.
Limit processed jobs to those containing substr as a substring of the
An alternate and obsolete form of the -f option.
-t Reads a message 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
-v Goes into verbose mode. Alias expansions will be announced, and so
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 correct
The sendmail command is not intended as a user interface routine. Other
programs provide user-friendly front ends; sendmail is used only to deliver
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 mes-
sage 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 expansion, 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 Docu-
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
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
Sets the blank substitution character to the character specified in the
Character argument. The sendmail daemon replaces unquoted spaces in
addresses with Character. The supplied configuration file uses a
period (.) for Character.
c 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.
dx Sets the delivery mode to x. Delivery modes are i for interactive (syn-
chronous) delivery, b for background (asynchronous) delivery, and q for
queue only (that is, actual delivery is done the next time the queue is
D Tries to automatically rebuild the alias database if necessary.
ex Sets error processing to mode x. Valid modes are the following:
e Mails the error message to the user's mailbox, but always exits with a
0 (zero) exit status (normal return).
m Mails the error message to the user's mailbox.
p Displays the error message on the terminal (default).
q Throws away the error message and returns the exit status only.
w Writes the error message to the terminal or mails it if the user is not
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.
f Saves UNIX compatible style From: lines at the front of messages.
G Enables GECOS fuzzy-logic name matching.
The GECOS field is a field in the /etc/passwd file that usually con-
tains 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 /etc/passwd file.
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 sendmail may work with john doe, john, or doe assuming that
this is the only john (or the only doe) in the file.
gN The default group ID to use when calling mailers.
The SMTP help file.
hN 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.
i Does not interpret a . (dot) on a line by itself as a message termina-
tor. Removes the excess dot inserted by a remote mailer at the begin-
ning 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 opposite of the action performed
by the X mailer option.
I Indicate that sendmail should use the Internet domain name server if it
j Send error messages in Multipurpose Internet Mail Extension (MIME) for-
Set connection cache time out.
kN Set connection cache size.
Specifies the log level to be the value supplied in the number argu-
ment. Each number includes the activities of all numbers of lesser
value and adds the activity that it represents. Valid levels and the
activities that they represent are as follows:
0 Prevents logging.
1 Logs major problems only.
2 Logs message collections and failed deliveries.
3 Logs successful deliveries.
4 Logs messages deferred (for example, because the host is down).
5 Logs messages that are placed in the queue (normal event).
6 Logs unusual but benign incidents (for example, trying to process a
9 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.
12 Logs messages that are of interest when debugging.
16 Logs verbose information regarding the queue.
m 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.
n Validates the right-hand side of alias rewrite rules when the sendmail
daemon performs the newaliases function.
o If set, this message may have old style headers. If not set, this mes-
sage is guaranteed to have new style headers (that is, commas instead
of spaces between addresses). If set, an adaptive algorithm is used
that will correctly 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
specification, so the time-out should probably be fairly large.
The sendmail Version 8 command has additional fine-grained control 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 collected if
the file exists. This file must be created by the user. The recom-
mended path for this is /var/adm/sendmail/sendmail.st. Statistics can
be printed out using /usr/sbin/mailstats.
s Always instantiates the queue file, even under circumstances where it
is not strictly necessary. This provides safety against system crashes
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.
uN Sets the default user ID for mailers.
v Runs in verbose mode.
Y 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 environment.
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 such as:
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 necessary 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 immediately, 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 run-
ning 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 send-
mail with the -bd option.
Mail addresses are based on the domain address (Internet) protocol. These
addresses have the form:
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 configura-
tion 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 specific 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 mes-
sage to its final destination. If the router is at hera, it delivers 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 corresponds 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 net-
work address determines the actual path that the message takes to its des-
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. How-
ever, 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 (sendmail)
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 command.
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
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:
For example, the address:
sends a message to user amy on UUCP host hera by way of system zeus.
sends a message to user lgh on UUCP host merlin via system apollo
under the local domain 802.
In this case, the address:
sends a message to user amy on system hera under domain 802 via the
UUCP link merlin through arthur.
In this example, the address:
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 identical.)
This example is a purely UUCP route address.
sends a message to amy on kronos via the UUCP link zeus through hera.
This example, like the previous one, is a purely UUCP route address.
sends a message to amy on kronos via the UUCP link zeus through hera.
Your host may also be configured to handle DECnet addresses. Under
DECnet Phase IV, an address is of the form
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 company). Simi-
larly, your host may also handle Phase V type addresses, such as
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
This file and the aliases.pag file comprise the database of alias
This file specifies the users who should receive mail on the local
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 path-
names 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.