sendmail
PURPOSE
Routes mail for local or network delivery.
SYNOPSIS
/usr/lib/sendmail [-bm] address
/usr/lib/sendmail [-ba -bd -bi -bp -bs -bt -bz][-bm][-bv]
[-Cfile -d x -F fullname -h n -n -ox[value] -q[time] -t -v]
[-f name -r name] address
/usr/lib/mailq
/usr/lib/newaliases
DESCRIPTION
The sendmail program receives formatted text messages and
routes the message to one or more other users on the
local system, or if connected to a network, to users on
other systems. The program translates the format of
message heading information to match the requirements of
the destination system. It determines which network to
use based on the syntax and content of the addresses.
The program can deliver messages to:
o Users on the local system
o Users connected to the local system using the TCP/IP
protocol
o Users connected to the local system using the uucp
protocol.
The sendmail program operates mainly as a background,
mail-routing program. Other programs, such as Mail and
the message handler routines, provide user interfaces for
generating and receiving mail that sendmail handles.
However, if you enter the sendmail command with no flags,
it reads standard input for the message text until it
receives a Ctrl-D or a line with only a single period,
designating the end of the message. Then it sends a copy
of the message to all addresses listed. For example, the
following input at the command line sends the message
"This is a test message" to the mail box for user
"george" on the local system:
$ /usr/lib/sendmail george
This is a test message
.
$
The sendmail program uses a configuration file
(/usr/adm/sendmail/sendmail.cf by default) to set many
operational parameters and to determine how the program
parses addresses. This file is a text file that you can
edit. However, sendmail uses a compiled form of this
file (/usr/adm/sendmail/sendmail.cfDB). For any changes
made to this file to be effective, you must build a new
copy of the compiled configuration file by running
sendmail with the -bz flag.
The sendmail program also allows you to define aliases to
use when addressing mail handled by the local sendmail
program. Aliases are alternate names that can be used in
place of elaborate network addresses. You can also use
aliases to build distribution lists. Define aliases in
/usr/adm/sendmail/aliases. This file is a text file that
you can edit. However, sendmail uses a data base version
of this file that is kept in the directory
/usr/adm/sendmail/aliasesDB. For any changes made to the
aliases file to be effective, you must build a new alias
data base by running sendmail with the -bi flag. If the
sendmail daemon is running, you must also stop that
process and start the daemon again before it recognizes
the new alias data base file. Normally the sender of a
message is not included when sendmail expands an alias
address. For example, if "amy" sends a message to alias
"D998" and she is defined as a member of that alias,
sendmail does not send a copy of the message to "amy".
Every system must have a user or user alias designated
postmaster. Assign this alias in the file
/usr/adm/sendmail/aliases. Unless you change the entry
in this file, this alias is assigned to "root". This
alias allows other users outside your system to send mail
to a known ID (i.e. "postmaster") to get information
about mailing to users on your system. Also, users on
your system can send problem notifications to this ID.
Two additional commands are links to sendmail:
/usr/lib/mailq Prints the contents of the mail
queue. This command is the same
as running sendmail with the -bp
flag.
/usr/lib/newaliases Builds a new copy of the alias
data base from the file
/usr/adm/sendmail/aliases. This
command is the same as running
sendmail with the -bi flag.
Mail Addresses
Mail addresses are based on the domain address (Arpanet)
protocol. These addresses have the following form:
user@host.domain
Note: The configuration file provided with sendmail
specifies that blanks in addresses be converted to
periods before being transmitted. This convention
follows the Arpanet mail protocol as described in RFC822,
but does not match the Arpanet mail protocol as described
in RFC733 (NIC41952). You can change this setting by
setting the OB option in the sendmail configuration file.
A domain is a logical grouping of systems that are con-
nected together by physical network links. No direct
relationship exists between the actual physical intercon-
nections 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. Domain names do not correspond to
system names, host addresses, or any other type of infor-
mation.
For example, if node "hera" is part of the domain "IBM",
which is in turn a subdomain of "COM", and a message is
sent to "geo" at that address it is sent to:
geo@hera.IBM.COM
The message router (usually sendmail) must determine how
to send the message 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
"IBM" 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 "IBM" domain, but is in a
domain that is under the "COM" domain, it corresponds
with the name server for the "COM" 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 with
a . (period). This format does not imply any routing.
Thus, although the example is specified as a "COM"
address, the message might actually travel by a different
route if that were more convenient or efficient. At some
sites, the message associated with the sample address
might go directly from the sender to node "hera" over a
local area network. At other sites 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 manu-
ally through several specified hosts to get it to its
final destination. An address using intermediate hosts,
called a route address, has the following form:
@hosta,@hostb:user@hostc
This address specifies that the message should go 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 the user may abbreviate the address rather
than typing 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.IBM.COM" can
send a message to "geo@hera.IBM.COM" by typing only
"geo@hera", because they are in the same local domain,
"IBM.COM".
Other mail address formats exist that are used by other
mail routing programs (such as, uucp). 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 fol-
lowing format:
@host:user
It converts it to the corresponding domain address
format:
user@host
Similarly, if sendmail receives an address in the fol-
lowing format:
host!user
The mail routing program routes the message directly to
the uucp command (part of the Basic Networking Utilities
(BNU)) However, when sending mail via uucp, you must
include a route address that indicates which BNU host(s)
to send the message through to get to the final destina-
tion.
To route messages through the BNU network, use one of the
following domain address formats. Your choice depends on
the way in which the systems at your site are connected:
1. @system_name.domain_name:uucp-route!user-ID
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".
2. uucp-route&colon!user-ID@system_name.domain_name
In this case, the address:
merlin!arthur!amy@hera.802
sends a message to user "amy" on system "hera" under
domain "802" via the BNU link "merlin" through
"arthur".
3. system_name.domain_name:uucp-route&colon!user-ID@system_
name.domain_name
In this example, the address:
@apollo.802:merlin!arthur!amy@hera.802
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
BNU link "merlin" through "arthur". (Including "802"
in this example is optional, since the two domain
names are identical.)
4. hosta!hostb!hostc!user
This example is a purely uucp route address:
zeus!hera!kronos!amy
sends a message to "amy" on "kronos", via the BNU
link "zeus" through "hera".
5. @hosta.UUCP:@hostb.UUCP:user@hostc
This example, like the previous one, is a purely uucp
route address:
@zeus.UUCP:@hera.UUCP:amy@kronos.UUCP
sends a message to "amy" on "kronos", via the BNU
link "zeus" through "hera".
Return Codes
The sendmail program returns an exit status code. These
exit codes are defined in /usr/include/bsd/sysexits.h.
The following table summarizes the meanings of these
return codes:
Return Code Meaning
EX_CANTCREAT The sendmail program cannot create a
file that the user specified.
EX_DATAERR The user's input data was not correct.
EX_IOERR An error occurred during I/O.
EX_NOHOST The sendmail program could not recog-
nize the specified host name.
EX_NOINPUT The sendmail program either could not
find, or could not read, the specified
input file.
EX_NOPERM The user does not have the needed per-
missions to perform the requested oper-
ation.
EX_NOUSER The sendmail program could not recog-
nize a specified user ID.
EX_OK The sendmail program successfully com-
pleted the operation for all addresses.
EX_OSERR A temporary operating system error
occurred. An example of such an error
is "cannot fork because too many
processes are currently running".
EX_OSFILE A system file error occurred. For
example, a system file (such as
/etc/passwd) does not exist, cannot be
opened or has another type of error
preventing it from being used.
EX_PROTOCOL The remote system returned something
that was incorrect during a protocol
exchange.
EX_SOFTWARE An internal software error occurred
(including bad arguments).
Return Code Meaning
EX_TEMPFAIL The sendmail program could not create a
connection. Try the request again
later.
EX_UNAVAILABLE A service or resource that sendmail
needed was not available.
EX_USAGE The command syntax was not correct.
FLAGS
-ba Starts sendmail in Arpanet mode. All input
lines to the program must end with a carriage
return and a line feed (CR-LF). The program
generates messages with a CR-LF at the end.
The program looks at the "from" and the
"sender" fields to find the name of the
sender.
-bd Starts sendmail to run in the background as a
TCP/IP mail routing daemon.
-bi Builds the alias database files from informa-
tion defined in /usr/adm/sendmail/aliases.
Running sendmail with this flag is the same
as running the command, /usr/lib/newaliases.
-bm Delivers mail in the usual way. This is the
default.
-bp Prints a listing of the mail queue. Running
sendmail with this flag is the same as
running the command, /usr/lib/mailq.
-bs Uses the simple mail transfer protocol (SMTP)
as described in RFC821. This flag implies
all of the operations of the -ba flag that
are compatible with SMTP.
-bt Starts sendmail in address test mode. This
mode allows you to enter addresses interac-
tively and watch as sendmail displays the
steps it takes to parse the address. Use
this mode for debugging the address parsing
rules in a new configuration file.
-bv Starts sendmail with a request to verify the
user IDs provided in the address field of the
command. The program responds with a message
telling which IDs can be resolved to a mailer
program. It does not try to collect or
deliver a message. Use this mode to validate
the format of user IDs, aliases or mailing
lists.
-bz Builds the compiled version of the configura-
tion file from information in
/usr/adm/sendmail/sendmail.cf.
-Cfile Starts sendmail using an alternate configura-
tion file specified by the file parameter.
Use this flag together with -bt to test a new
configuration file before installing it as
the running configuration file.
-dX Sets debugging value to X.
-Ffullname Sets the full name of the sender to be the
string provided in the fullname parameter.
-fname Sets the name of the from person (the sender
of the mail). This flag can be used only by
those administrative user IDs designated in
the configuration file with the T control
line, or if your ID is the ID supplied in
name.
-hN Sets the hop count to N. The hop count is
the number of times that the message has been
processed by a sendmail program (not just the
local copy of sendmail). The program incre-
ments the hop count every time the message is
processed. When it reaches a limit, the
message is returned with an error message
usually caused by alias looping.
-n Does not do aliasing.
-ox[value] Sets option x. If the option is a valued
option, you must also specify value. See
Figure 10 for possible options, values and
their meanings.
-q[time] Processes saved messages in the queue at the
intervals specified by time. If time is not
specified, this flag processes the queue at
once. You can specify time as a tagged
number using the tag s for seconds, m for
minutes, h for hours, d for days, and w for
weeks. If the tag letter is omitted and just
a number is specified, sendmail uses days as
the unit of time. For example, "-q2m" proc-
esses the queue every two minutes, but "-q2"
processes the queue every two days.
-rname An alternate and obsolete form of the -f
flag.
-t Reads the "To:", "Cc:", and "Bcc:" lines of
the message header to determine where to send
the message; deletes the "Bcc:" line before
transmitting the message; and deletes any
addresses in the argument list of the
sendmail command.
-v Starts sendmail in verbose mode. The program
displays messages regarding the status of
transmission, the expansion of aliases and
any errors that may occur during the sending
of the message.
You can also set or remove of sendmail processing
options. Normally, the person responsible for the mail
system uses these options. To set these options, use the
-o flag on the command line or the "0" control line in
the configuration file (sendmail.cf).
Option Function
Afile Uses the named file as an alternate alias
file.
Bc Sets the blank substitution character to the
character specified in the parameter c. The
sendmail program replaces unquoted spaces in
addresses with this character. The supplied
configuration file uses the period (.) for
this character.
c If an outgoing mailer program is specified in
the configuration file as being expensive to
use, this option causes sendmail to queue
messages for that mailer program without
sending them. The queue can be run later
when costs are lowest or when the queue is
large enough to send the messages effi-
ciently.
dx Sets the delivery mode to x. Delivery modes
are i for interactive (synchronous) delivery,
b for background (asynchronous) delivery, and
q for queue only (next time the queue is run)
delivery. The supplied configuration file
uses a value of b.
ex Sets error processing to mode x. Valid modes
are:
m Mails the error message to the
user's mail box.
w Writes the error message to the
terminal or mails it if the user is
not logged in.
p Displays the error message on the
terminal (default).
q Throws away error message and
returns the exit status only.
e Mails the error message to the
user's mail box, but always exits
with a zero exit status (normal
return).
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 file dead.letter in the sender's home
directory.
f Saves "From" lines at the front of messages.
These lines are normally discarded.
Figure 10 (Part 1 of 4). Configuration Options
Option Function
gN Sets the default group ID to use when calling
mailers to the value specified by N.
Hfile Specifies the name of the SMTP help file
(/usr/adm/sendmail/sendmail.hf by default).
i Does not interpret a period (.) on a line by
itself as a message terminator.
Ic Interpret the special character specified by
c as a space character and all real spaces as
delimiters when processing address parsing
rules. Use this control line if using an
editor that saves tabs as spaces (such as
INed) to edit the configuration file. The
default setting of this line is "I_".
Ln Specifies the log level to be the value sup-
plied in the n parameter. Valid levels and
the activities that they represent are (each
number includes the activities of all numbers
of lesser value and adds the activity that it
represents):
Level Activity Logged
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
locked file).
9 Logs internal queue id to external
message id mappings. 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.
Mx value Sets the macro x to value. Use this option
from the command line only (with the -o
flag).
m Sends to the sender (me) also, if the sender
is in an alias expansion. Normally, the
sender does not receive a copy of the
message.
Figure 10 (Part 2 of 4). Configuration Options
Option Function
Nnetname Sets the name of the host network to netname.
The sendmail program compares the argument of
an SMTP HELO command to hostname.netname (it
gets the value of hostname from the kernel).
If these values do not match, it adds the
hostname.netname string to the "Received:"
lines in the message so that messages can be
traced accurately.
o This option indicates that this message may
have old style headers. Without this option,
the message has new style headers (commas
instead of spaces between addresses). If
this option is set, an adaptive algorithm
correctly determines the header format in
most cases.
Qdir Sets the directory in which to queue messages
to the directory specified by the dir param-
eter. That directory must exist.
rtime Sets the timeout for reads from a mailer
program to the value specified by time. If
no timeout value is set, sendmail waits
indefinitely for a mailer to respond. The
default value for this timeout is 5 minutes.
Sfile Sets the mail statistics file to the file.
If this file exists, sendmail stores statis-
tics about mail traffic in a data base format
in this file. Use the mailstats command to
read the information in this file. If the
indicated file does not exist, no statistic
information is saved.
s Interactive mode delivers mail without going
through the mail queue. When this option is
specified, mail is passed through the mail
queue in interactive mode also. This action
ensures that the message being sent is not
lost if a delivery problem occurs.
Ttime Sets the timeout on messages in the queue to
the specified time. After a message has been
in the queue for this amount of time,
sendmail returns the message to the sender.
In sendmail.cf that is provided with
sendmail, this value is set to three days.
uN Sets the default user ID to use when calling
mailers to the value specified by N.
v Run in verbose mode.
Figure 10 (Part 3 of 4). Configuration Options
Option Function
Y When this option is specified, sendmail
delivers each message in the mail queue from
a separate process. This option uses less
memory to process the mail queue. Use of
this option is not recommended.
Figure 10 (Part 4 of 4). Configuration Options
FILES
/usr/lib/sendmail Contains the sendmail
program.
/usr/lib/mailq Displays list of the
mail queue.
/usr/lib/newaliases Builds alias data
base.
/usr/lib/mailstats Displays sendmail
statistics found in
/usr/adm/sendmail/sendmail.st.
/usr/lib/sendmail.sh Contains a shell
script replacement
for sendmail when
sendmail is not
installed. Only
local mail can be
delivered with this
shell script acting
as sendmail.
/usr/adm/sendmail/aliases Contains the text
version of sendmail
aliases.
/usr/adm/sendmail/aliasesDB/DB.dir Contains one of the
alias data base
files.
/usr/adm/sendmail/aliasesDB/DB.pg Contains one of the
alias data base
files.
/usr/adm/sendmail/aliasesDBl Contains the alias
data base lock file.
/usr/adm/sendmail/sendmail.hf Contains the SMTP
help file.
/usr/adm/sendmail/sendmail.cf Contains the text
version of the
sendmail configura-
tion file.
/usr/adm/sendmail/sendmail.cfDB Contains the sendmail
configuration data
base file.
/usr/adm/sendmail/sendmail.cfDBl Contains the sendmail
configuration data
base lock file.
/usr/adm/sendmail/sendmail.st Contains the sendmail
statistics file.
/usr/adm/sendmail/smdemon.cleanu Maintains aging
copies of the log
file in
/usr/spool/mqueue.
/etc/rc.sendmail Contains the shell
script to start the
sendmail daemon.
/usr/spool/mqueue Contains the log file
and temporary files
associated with the
messages in the mail
queue (the mail queue
directory). Tempo-
rary files have names
that include the mail
queue ID (mqid) of
the message for which
the file was created:
dfmqid Data file
lfmqid Lock file
nfmqid Backup file
qfmqid Queue
control
file
tfmqid Temporary
control
file
xfmqid Transcript
file for
session.
/usr/spool/cron/crontabs/root Contains a commented
entry to run sendmail
periodically for use
when not routing mail
to a network. Uncom-
ment that entry to
process the mail
queue at the interval
specified in that
cron file.
/bin/uux Contains the mailer
program to deliver
uucp mail.
/bin/bellmail Contains the mailer
program to deliver
local mail.
RELATED INFORMATION
The following commands: "bellmail," "mail, Mail,"
"uux."
The book Interface Program for use with TCP/IP.
The chapter about managing the mail system in IBM RT PC
Managing the AIX Operating System.
The chapter about sending and receiving mail in IBM RT PC
Using the AIX Operating System.
The file sendmail.cf in AIX Operating System Technical
Reference.