[Go to CFHT Home Page] Man Pages
Back to Software Index  BORDER=0Manpage Top Level
    sendmail(1M) manual page Table of Contents

Name

sendmail - send mail over the internet

Synopsis

/usr/lib/sendmail [ -ba ] [ -bd ] [ -bi ] [ -bm ] [ -bp ] [ -bs ] [ -bt ] [ -bv ] [ -B type ] [ -C file ] [ -d X ] [ -F fullname ] [ -f name ] [ -h N ] [ -M id ] [ -n ] [ -o xvalue ] [ -p protocol ] [ -q [ time ] ] [ -q Xstring ] [ -r name ] [ -t ] [ -v ] [ -X logfile ] [ address ... ]

Availability

SUNWcsu

Description

sendmail sends a message to one or more people, 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 pre-formatted messages.

With no flags, sendmail reads its standard input up to an EOF , or a line with a single dot, and sends a copy of the letter found there to all of the addresses listed. It determines the network to use based on the syntax and contents of the addresses.

Local addresses are looked up in the local aliases(4) file, or by using the YP name service, and aliased appropriately. In addition, if there is a .forward file in a recipient’s home directory, sendmail forwards a copy of each message to the list of recipients that file contains. Aliasing can be prevented by preceding the address with a backslash. Normally the sender is not included in 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’.

sendmail will also route mail directly to other known hosts in a local network. The list of hosts to which mail is directly sent is maintained in the file /usr/lib/mailhosts.

If a letter is found to be undeliverable, it is returned to the sender with diagnostics that indicate the location and nature of the failure; or, the letter is placed in a dead.letter file in the sender’s home directory.

Options

-ba
Go into ARPANET mode. All input lines must end with a RETURN-LINEFEED , and all messages will be generated with a RETURN-LINEFEED at the end. Also, the From: and Sender: fields are examined for the name of the sender.
-bd
Run as a daemon, waiting for incoming SMTP connections.
-bi
Initialize the aliases(4) database.
-bm
Deliver mail in the usual way (default).
-bp
Print a summary of the mail queue.
-bs
Use the SMTP protocol as described in RFC 821. This flag implies all the operations of the -ba flag that are compatible with SMTP .
-bt
Run in address test mode. This mode reads addresses and shows the steps in parsing; it is used for debugging configuration tables.
-bv
Verify names only -- do not try to collect or deliver a message. Verify mode is normally used for validating users or mailing lists.
-B type
indicate body type (7BIT or 8BITMIME )
-C file
Use alternate configuration file.
-d X
Set debugging value to X.
-F fullname
Set the full name of the sender.
-f name
Sets the name of the ‘from’ person (that is, the sender of the mail). -f can only be used by ‘trusted’ users (who are listed in the configuration file).
-h N
Set 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.
-M id
Attempt to deliver the queued message with message-id id. This option is supported for backward compatibility and the -qI option is preferred.
-n
Do not do aliasing.
-o xvalue
Set option x to the specified value. Processing Options are described below.
-p protocol
Set the sending protocol. Programs are encouraged to set this. The protocol field can be in form protocol:host to set both the sending protocol and the sending host. For example:

-pUUCP:uunet

sets the sending protocol to UUCP and the sending host to uunet. (Some existing programs use -oM to set the r and s macros; this is equivalent to using -p).

-q[time]
Process saved messages in the queue at given intervals. If time is omitted, process the queue once. time 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.
-q Xstring
Run the queue once, limiting the jobs to those matching Xstring. The key letter X can be:

I
to limit based on queue identifier (see -M option).
R
to limit based on recipient (see -R option).
S
to limit based on sender.
A particular queued job is accepted if one of the
corresponding addresses contains the indicated string.
-r name
An alternate and obsolete form of the -f flag.
-R string
Go through the queue of pending mail and attempt to deliver any message with a recipient containing the specified string. This is useful for clearing out mail directed to a machine which has been down for awhile. This option is supported for backward compatibility and the -qR option is preferred.
-t
Read message for recipients. To:, Cc:, and Bcc: lines will be scanned for people to send to. The Bcc: line will be deleted before transmission. Any addresses in the argument list will be suppressed.
-v
Go into verbose mode. Alias expansions will be announced, etc.
-X logfile
Log all traffic in and out of sendmail in the indicated logfile for debugging mailer problems. This produces a lot of data very quickly and should be used sparingly.

Processing Options

There are a number of "random" options that can be set from a configuration file. Options are represented by single characters. The syntax of this line is:

Oovalue

This sets option o to be value. Depending on the option, value may be

The options supported are:

aN
If set, wait up to N minutes for an "@:@" entry to exist in the aliases(4) database before starting up. If it does not appear in N minutes, rebuild the database (if the D option is also set) or issue a warning.
Afile
Specify possible alias file(s).
bN/M
Insist on at least N blocks free on the filesystem that holds the queue files before accepting email via SMTP . If there is insufficient space sendmail gives a 452 response to the MAIL command. This invites the sender to try again later. The optional M is a maximum message size advertised in the ESMTP response. It is currently otherwise unused.
Bc
Set the blank substitution character to c. Unquoted spaces in addresses are replaced by this character. Defaults to SPACE (i.e., no change is made).
c
If an outgoing mailer is marked as being expensive, don’t connect immediately.
CN
Checkpoints the queue every N (default 10) addresses sent. If your system crashes during delivery to a large list, this prevents retransmission to any but the last N recipients.
dx
Deliver in mode x. Legal modes are:

i
Deliver interactively (synchronously)
b
Deliver in background (asynchronously)
q
Just queue the message (deliver during queue run)

Defaults to
b if no option is specified, i if it is specified but given no argument (i.e., Od is equivalent to Odi).
D
If set, rebuild the /etc/mail/aliases database if necessary and possible. If this option is not set, sendmail will never rebuild the aliases database unless explicitly requested using -bi, or newaliases(1) is invoked.
ex
Dispose of errors using mode x. The values for x are:

p
Print error messages (default)
q
No messages, just give exit status
m
Mail back errors
w
Write back errors (mail if user not logged in)
e
Mail back errors and give zero exit stat always

Efile/message
Prepend error messages with the indicated message. If it begins with a slash, it is assumed to be the pathname of a file containing a message (this is the recommended setting). Otherwise, it is a literal message. The error file might contain the name, email address, and/or phone number of a local postmaster who could provide assistance in to end users. If the option is missing or null, or if it names a file which does not exist or which is not readable, no message is printed.
f
Save Unix-style From lines at the front of headers. Normally they are assumed redundant and discarded.
Fmode
The file mode for queue files.
gn
Set the default group ID for mailers to run in to n. Defaults to 1. The value can also be given as a symbolic group name.
hN
The maximum hop count. Messages that have been processed more than N times are assumed to be in a loop and are rejected. Defaults to 25.
Hfile
Specify the help file for SMTP .
i
Ignore dots in incoming messages. This is always disabled (that is, dots are always accepted) when reading SMTP mail.
I
Insist that the name server be running to resolve host names. If this is not set and the name server is not running, the /etc/hosts file (see hosts(4) ) will be considered complete. In general, you do want to set this option if your /etc/hosts file does not include all hosts known to you or if you are using the MX (mail forwarding) feature of the name server. The name server will still be consulted even if this option is not set, but sendmail will feel free to resort to reading /etc/hosts if the name server is not available. Thus, you should never set this option if you do not run the name server.
j
If set, send error messages in MIME format (see RFC1341 and RFC1344 for details).
Jpath
Set the path for searching for users’ .forward files. The default is $z/.forward. Some sites that use the automounter may prefer to change this to /var/forward/$u to search a file with the same name as the user in a system directory. It can also be set to a sequence of paths separated by colons; sendmail stops at the first file it can successfully and safely open. For example, /var/forward/$u:$z/.forward will search first in /var/forward/ username and then in ~username/.forward (but only if the first file does not exist).
kN
The maximum number of open connections that will be cached at a time. The default is one. This delays closing the current connection until either this invocation of sendmail needs to connect to another host or it terminates. Setting it to zero defaults to the old behavior, that is, connections are closed immediately.
Ktimeout
The maximum amount of time a cached connection will be permitted to idle without activity. If this time is exceeded, the connection is immediately closed. This value should be small (on the order of ten minutes). Before sendmail uses a cached connection, it always sends a NOOP (no operation) command to check the connection; if this fails, it reopens the connection. This keeps your end from failing if the other end times out. The point of this option is to be a good network neighbor and avoid using up excessive resources on the other end. The default is five minutes.
l
If there is an Errors-To: header, send error messages to the addresses listed there. They normally go to the envelope sender. Use of this option causes sendmail to violate RFC 1123.
Ln
Set the default log level to n. Defaults to 9.
m
Send to me too, even if I am in an alias expansion.
Mxvalue
Set the macro x to value. This is intended only for use from the command line.
n
Validate the RHS of aliases when rebuilding the aliases(4) database.
o
Assume that the headers may be in old format, i.e., spaces delimit names. This actually turns on an adaptive algorithm: if any recipient address contains a comma, parenthesis, or angle bracket, it will be assumed that commas already exist. If this flag is not on, only commas delimit names. Headers are always output with commas between the names.
Ooptions
Set server SMTP options. The options are key=value pairs. Known keys are:

Port
Name/number of listening port (defaults to smtp)
Addr
Address mask (defaults INADDR_ANY )
Family
Address family (defaults to INET )
Listen
Size of listen queue (defaults to 10)

The
Address mask may be a numeric address in dot notation or a network name.
popt,opt,...
Set the privacy options. ‘‘Privacy’’ is really a misnomer; many of these are just a way of insisting on stricter adherence to the SMTP protocol. The options can be selected from:

public
Allow open access
needmailhelo
Insist on HELO or EHLO command before MAIL
needexpnhelo
Insist on HELO or EHLO command before EXPN
noexpn
Disallow EXPN entirely
needvrfyhelo
Insist on HELO or EHLO command before VRFY
novrfy
Disallow VRFY entirely
restrictmailq
Restrict mailq command
restrictqrun
Restrict -q command line flag
goaway
Disallow essentially all SMTP status queries
authwarnings
Put X-Authentication-Warning:
headers in messages
The
goaway pseudo-flag sets all flags except restrictmailq and restrictqrun. If mailq is restricted, only people in the same group as the queue directory can print the queue. If queue runs are restricted, only root and the owner of the queue directory can run the queue. Authentication Warnings add warnings about various conditions that may indicate attempts to spoof the mail system, such as using an non-standard queue directory.
Ppostmaster
If set, copies of error messages will be sent to the named postmaster. Only the header of the failed message is sent. Since most errors are user problems, this is probably not a good idea on large sites, and arguably contains all sorts of privacy violations, but it seems to be popular with certain operating systems vendors.
qfactor
Use factor as the multiplier in the map function to decide when to just queue up jobs rather than run them. This value is divided by the difference between the current load average and the load average limit (x flag) to determine the maximum message priority that will be sent. Defaults to 600000.
Qdir
Use the named dir as the queue directory.
r timeouts
Timeout reads after time interval. The timeouts argument is a list of keyword=value pairs. The recognized timeouts and their default values, and their minimum values specified in RFC 1123 section 5.3.2 are:

initial
wait for initial greeting message [5m, 5m]
helo
reply to HELO or EHLO command [5m, none]
mail
reply to MAIL command [10m, 5m]
rcpt
reply to RCPT command [1h, 5m]
datainit
reply to DATA command [5m, 2m]
datablock
data block read [1h, 3m]
datafinal
reply to final ‘‘.’’ in data [1h, 10m]
rset
reply to RSET command [5m, none]
quit
reply to QUIT command [2m, none]
misc
reply to NOOP and VERB commands [2m, none]
command
command read [1h, 5m]
ident
IDENT protocol timeout [30s, none]

All but command apply to client SMTP . For backward compatibility, a timeout with no keyword= part will set all of the longer values.

s
Be super-safe when running things, i.e., always instantiate the queue file, even if you are going to attempt immediate delivery. sendmail always instantiates the queue file before returning control the client under any circumstances.
Sfile
Log statistics in the named file.
ttzinfo
Set the local time zone info to tzinfo -- for example, "PST8PDT ." Actually, if this is not set, the TZ environment variable is cleared (so the system default is used); if set but null, the user’s TZ variable is used, and if set and non-null the TZ variable is set to this value.
Trtime/wtime
Set the queue timeout to rtime. After this interval, messages that have not been successfully sent will be returned to the sender. Defaults to five days (5d) . The optional wtime is the time after which a warning message is sent. If it is missing or zero then no warning messages are sent.
un
Set the default userid for mailers to n. Mailers without the S flag in the mailer definition will run as this user. Defaults to 1. The value can also be given as a symbolic user name.
v
Run in verbose mode. If this is set, sendmail adjusts options c (don’t connect to expensive mailers) and d (delivery mode) so that all mail is delivered completely in a single job so that you can see the entire delivery process. Option v should never be set in the configuration file; it is intended for command line use only.
Vfallbackhost
If specified, the fallbackhost acts like a very low priority MX on every host. This is intended to be used by sites with poor network connectivity.
w
If you are the "best" (that is, lowest preference) MX for a given host, you should normally detect this situation and treat that condition specially, by forwarding the mail to a UUCP feed, treating it as local, or whatever. However, in some cases (such as Internet firewalls) you may want to try to connect directly to that host as though it had no MX records at all. Setting this option causes sendmail to try this. The downside is that errors in your configuration are likely to be diagnosed as "host unknown" or "message timed out" instead of something more meaningful. This option is disrecommended.
xLA
When the system load average exceeds LA, just queue messages (i.e., don’t try to send them). Defaults to 8.
XLA
When the system load average exceeds LA, refuse incoming SMTP connections. Defaults to 12.
yfact
The indicated factor (fact) is added to the priority (thus lowering the priority of the job) for each recipient, i.e., this value penalizes jobs with large numbers of recipients. Defaults to 30000.
Y
If set, deliver each job that is run from the queue in a separate process. Use this option if you are short of memory, since the default tends to consume considerable amounts of memory while the queue is being processed.
zfact
The indicated factor (fact) or is multiplied by the message class (determined by the Precedence: field in the user header and the P lines in the configuration file) and subtracted from the priority. Thus, messages with a higher Priority: will be favored. Defaults to 1800.
Zfact
The fact or is added to the priority every time a job is processed. Thus, each time a job is processed, its priority will be decreased by the indicated value. In most environments this should be positive, since hosts that are down are all too often down for a long time. Defaults to 90000.
  • Strip input to seven bits for compatibility with old systems. This shouldn’t be necessary.
  • All options can be specified on the command line using the -o flag, but most will cause sendmail to relinquish its setuid permissions. The options that will not cause this are b, d, e, E, i, L, m, o, p, r, s, v, C, and 7. Also, M (define macro) when defining the r or s macros is also considered "safe ."

    If the first character of the user name is a vertical bar, the rest of the user name is used as the name of a program to pipe the mail to. It may be necessary to quote the name of the user to keep sendmail from suppressing the blanks from between arguments.

    sendmail returns an exit status describing what it did. The codes are defined in /usr/include/sysexits.h.

    EX_OK
    Successful completion on all addresses.
    EX_NOUSER
    User name not recognized.
    EX_UNAVAILABLE
    Catchall. Necessary resources were not available.
    EX_SYNTAX
    Syntax error in address.
    EX_SOFTWARE
    Internal software error, including bad arguments.
    X_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.

    If invoked as newaliases, sendmail rebuilds the alias database. If invoked as mailq, sendmail prints the contents of the mail queue.

    Files

    dead.letter
    unmailable text
    /etc/mail/sendmail.cf
    defines environment for sendmail
    /var/spool/mqueue/*
    temp files and queued mail
    ~/.forward
    list of recipients for forwarding messages

    See Also

    biff(1B) , mail(1) , mailx(1) , newaliases(1) , aliases(4) hosts(4)

    Su, Zaw-Sing, and Jon Postel, The Domain Naming Convention for Internet User Applications, RFC 819, Network Information Center, SRI International, Menlo Park, Calif., August 1982.

    Postel, Jon, Simple Mail Transfer Protocol, RFC 821, Network Information Center, SRI International, Menlo Park, Calif., August 1982.

    Crocker, Dave, Standard for the Format of ARPA -Internet TextMessages, RFC 822, Network Information Center, SRI International, Menlo Park, Calif., August 1982.


    Table of Contents