sendmail(8) — Maintenance
OSF
NAME
sendmail − Sends mail over the Internet
SYNOPSIS
sendmail [-flags] [address ...]
newaliases
mailq [-v]
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 IPC. The sendmail command will fork and run in the background, listening on socket 25 for incoming SMTP (Simple Mail Transfer Protocol) connections. This is normally run when going to multiuser mode.
−biInitializes the alias database.
−bmDelivers mail in the usual way (default).
−bpPrints a listing of the queue.
−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.
−btRun 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.
−bzCreates the configuration freeze 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.
−FfullnameSets the full name of the sender.
−fnameSets the name of the from user (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.
−hNSet 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.
−oXvalueSets X to the specified value. Processing flags specified with -o are described in the section Processing Flags 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 timeout to one hour thirty minutes. If the time command is specified, the sendmail command will run in background. This flag can be used safely with −bd.
−rnameAn alternate and obsolete form of the −f flag.
−tReads message for recipients. 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.
sendmail 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 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 expansion, then the letter will not be delivered to john.
Processing Flags
There are a number of sendmail processing flags that may be set. Normally, these will only be used by a system administrator. Processing flags may be set either on the command line using the −o flag or in the configuration 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 queueing.
-dxSet 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:
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 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 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.
-QqueuedirSelects 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 instantiate 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.
Aliase Interpretation
In aliases, the first character of a name may 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 may contain a common alias such as:
msgs: "|/usr/bin/msgs -s"
Aliases may 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"
would read /usr/local/lib/poets.list for the list of addresses making up the group.
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_NOUSER
Username not recognized.
EX_UNAVAILABLE
Catchall meaning necessary resources were not available.
EX_SYNTAX
Syntax error in address.
EX_SOFTWARE
Internal software error, including bad arguments.
EX_OSERR
Temporary operating system error, such as cannot fork.
EX_NOHOST
Host name not recognized.
EX_TEMPFAIL
Message could not be sent immediately, but was queued.
Links to sendmail
Two additional commands are links to sendmail:
/usr/bin/mailq
Prints the contents of the mail queue. This command is the same as running sendmail with the -bp flag.
/usr/bin/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.
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 sendmail.cf(4)).
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 with 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 .
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:
@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.
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.
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.)
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.
@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/sendmail
Specifies the command path
/var/adm/sendmail.cf
Configuration file
/var/adm/sendmail/aliases
Raw data for alias names
/var/adm/sendmail/aliases.pag
/var/adm/sendmail/aliases.dir
Database of alias names
/var/adm/sendmail/sendmail.fc
Frozen configuration
/usr/share/lib/sendmail.hf
Help file
/var/adm/sendmail/sendmail.st
Collected statistics
/var/adm/sendmail/mqueue/∗
Temp files
Except for /usr/sbin/sendmail and /var/adm/sendmail.cf, the pathnames above are all specified in the /var/adm/sendmail.cf file, so they may vary on your system.
RELATED INFORMATION
Commands: mail(1), mailx(1), rc0(8)
Functions: syslog(3)
Files: aliases(4)
Specifications: RFC819, RFC821, RFC822
DARPA Internet Request For Comments