sendmail(8) — Maintenance
NAME
sendmail, newaliases, mailq, smtpd − Sends mail over the Internet
SYNOPSIS
/usr/sbin/sendmail [−flags] [address ...]
/usr/sbin/newaliases
/usr/sbin/mailq [−v]
/usr/sbin/smtpd
FLAGS
−baGoes 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.
−bdRuns 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 incoming SMTP (Simple Mail Transfer Protocol) connections. This is normally run when going to multiuser mode.
Using this flag is equivalent to invoking sendmail as smtpd.
−biInitializes the alias database. This is the same as invoking the newaliases command.
−bmDelivers mail in the usual way (default).
−bpPrints a listing of the queue. This is the same as invoking the mailq command.
−bsUse the SMTP protocol as described in RFC821 on standard input and output. This flag implies all the operations of the −ba flag that are compatible with SMTP.
−btRuns in address test mode. This mode reads addresses and shows the steps in parsing; it is used for debugging configuration tables.
−bvVerifies names only. Does not try to collect or deliver a message. Verify mode is normally used for validating users or mailing lists.
−bzThis option is not supported in Digital UNIX.
Creates the frozen configuration file. A frozen configuration file (sendmail.fc) is a copy of your sendmail.cf file that has already been parsed. This file should allow sendmail to have faster startup times. If you already have a frozen configuration file, you must run sendmail with the −bz flag each time you make changes to the sendmail.cf file. This will rebuild the frozen configuration file.
−CfileUses alternate configuration file. The sendmail command refuses to run as root if an alternate configuration file is specified. The frozen configuration file is bypassed.
−dXSets 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 flag. Higher values of n produce more verbose information.
−F fullname
Sets the full name of the sender.
−f nameSets the name of the From: user field (that is, the sender of the mail). −f 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.
−hNSets 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.
−nDoes not do aliasing or forwarding.
−oXvalue
Sets X to the specified value. Processing flags specified with −o are described in the Processing Flags section later in this reference page.
−q[time]
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 flag can be used safely with −bd.
−rnameAn alternate and obsolete form of the −f flag.
−tReads 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 header.
−vGoes into verbose mode. Alias expansions will be announced, and so forth.
DESCRIPTION
The sendmail command sends a message to one or more recipients, routing the message over whatever networks are necessary. sendmail does internetwork forwarding as necessary to deliver the message to the correct place.
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 flags, 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 \\*O (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.
Processing Flags
There are a number of sendmail processing flags that can be set. Normally, these will only be used by a system administrator. Processing flags can be set either on the command line using the −o flag or in the configuration file. (Refer to the sendmail.cf reference page for details on the sendmail.cf file.)
The processing flags are as follows:
AfileUses alternate alias file.
cOn mailers that are considered “expensive” to connect to, does not initiate immediate connection. This requires queuing.
dxSets 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).
DTries to automatically rebuild the alias database if necessary.
exSets error processing to mode x. Valid modes are the following:
mMails the error message to the user’s mailbox.
wWrites the error message to the terminal or mails it if the user is not logged in.
pDisplays the error message on the terminal (default).
qThrows away the error message and returns the exit status only.
eMails the error message to the user’s mailbox, but always exits with a 0 (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 dead.letter file in the sender’s home directory.
FmodeThe mode to use when creating temporary files.
fSaves UNIX compatible style From: lines at the front of messages.
gNThe default group ID to use when calling mailers.
HfileThe SMTP help file.
iDoes not consider a . (dot) on a line by itself to be a message terminator.
LnumberSpecifies the log level to be the value supplied in the number argument. 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:
0Prevents logging.
1Logs major problems only.
2Logs message collections and failed deliveries.
3Logs successful deliveries.
4Logs messages deferred (for example, because the host is down).
5Logs messages that are placed in the queue (normal event).
6Logs unusual but benign incidents (for example, trying to process a locked file).
9Logs the internal queue ID to external message ID mappings. This can be useful for tracing a message as it travels between several hosts.
12Logs messages that are of interest when debugging.
16Logs verbose information regarding the queue.
mSends to me (the sender) also if I am in an alias expansion.
oIf 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 correctly determine the header format in most cases.
Qqueuedir
Selects the directory in which to queue messages.
rtimeoutThe time-out on reads. If none is set, sendmail will wait forever for a mailer. This flag violates the word (if not the intent) of the SMTP specification, so the time-out should probably be fairly large.
SfileSaves statistics in the named file.
sAlways instantiates the queue file, even under circumstances where it is not strictly necessary. This provides safety against system crashes during delivery.
TtimeSets 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 is 3 days.
tstz,dtzSets the name of the time zone.
uNSets the default user ID for mailers.
vRuns in verbose mode.
Aliases Interpretation
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:
poets: ":include:/usr/local/lib/poets.list"
reads /usr/local/lib/poets.list for the list of addresses making up the group.
You can also use the Network Information Service (NIS) to distribute your aliases to other systems.
Exit Status
The sendmail command returns an exit status describing what it did. The codes are defined in <sysexits.h>:
EX_OKSuccessful completion on all addresses.
EX_NOUSERThe username was not recognized.
EX_UNAVAILABLEA catchall meaning necessary resources were not available.
EX_SYNTAXThere is a syntax error in the address.
EX_SOFTWAREThere is an internal software error, including bad arguments.
EX_OSERRThere is a temporary operating system error, such as cannot fork.
EX_NOHOSTThe hostname was not recognized.
EX_TEMPFAILThe message could not be sent immediately, but was queued.
Links to sendmail
Three additional commands are links to sendmail:
/usr/sbin/mailq
Prints the contents of the mail queue. This command is the same as running sendmail with the −bp flag.
/usr/sbin/newaliases
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 flag.
/usr/sbin/smtpd
Runs sendmail as a daemon. This command is equivalent to invoking sendmail with the −bd flag.
Mail Addresses
Mail addresses are based on the domain address (Internet) protocol. These addresses have the form:
user@host.domain
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 flag 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 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 format:
hera.OSF.ORG
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 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 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 a 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:
@hosta,@hostb:user@hostc
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:
@host:user
it converts it to the corresponding domain address format:
user@host
Similarly, if sendmail receives an address in the following format:
host!user
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 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:
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:!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 UUCP link merlin through arthur.
3.system_name.domain_name:uucp-route:!user-ID@system_namedomain_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 UUCP link merlin through arthur. (Including 802 in this example is optional because 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 UUCP 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 UUCP link zeus through hera.
FILES
/usr/sbin/sendmailSpecifies the command path.
/var/adm/sendmail/sendmail.cf
The configuration file.
/var/adm/sendmail/aliasesThe raw data for alias names.
/var/adm/sendmail/aliases.pag
This file and the aliases.dir file comprise the database of alias names.
/var/adm/sendmail/aliases.dir
This file and the aliases.pag file comprise the database of alias names.
/var/adm/sendmail/sendmail.fc
A frozen configuration.
This option is not supported in Digital UNIX.
/usr/share/lib/sendmail.hfThe help file.
/var/adm/sendmail/sendmail.st
The collected statistics.
/usr/spool/mqueue/∗The temporary files.
Except for /usr/sbin/sendmail and /var/adm/sendmail.cf, the preceding pathnames are all specified in the /var/adm/sendmail.cf file, so they may vary on your system.
RESTRICTIONS
The -bz option is not supported in Digital UNIX.
RELATED INFORMATION
Commands: mail(1), mailx(1), rc0(8)
Functions: syslog(3)
Files: aliases(4), sendmail.cf(4)
Specifications: RFC819, RFC821, RFC822