hooks for distributed user database system
[unix-history] / usr / src / usr.sbin / sendmail / src / sendmail.8
CommitLineData
b42074ab 1.\" Copyright (c) 1988, 1991 The Regents of the University of California.
08e47b66 2.\" All rights reserved.
5412ac7d 3.\"
a280d268 4.\" %sccs.include.redist.man%
08e47b66 5.\"
8a12fae4 6.\" @(#)sendmail.8 6.9 (Berkeley) %G%
5412ac7d 7.\"
b42074ab
CL
8.Dd
9.Dt SENDMAIL 8
10.Os BSD 4
11.Sh NAME
12.Nm sendmail
13.Nd send mail over the internet
14.Sh SYNOPSIS
15.Nm sendmail
16.Op Ar flags
17.Op Ar address ...
18.Nm newaliases
19.Nm mailq
20.Op Fl v
21.Sh DESCRIPTION
22.Nm Sendmail
8e8bec7f 23sends a message to one or more
b42074ab 24.Em recipients ,
8de6f6c6 25routing the message over whatever networks
5412ac7d 26are necessary.
b42074ab 27.Nm Sendmail
8de6f6c6
KM
28does internetwork forwarding as necessary
29to deliver the message to the correct place.
b42074ab
CL
30.Pp
31.Nm Sendmail
5412ac7d 32is not intended as a user interface routine;
8de6f6c6
KM
33other programs provide user-friendly
34front ends;
b42074ab 35.Nm sendmail
8de6f6c6 36is used only to deliver pre-formatted messages.
b42074ab 37.Pp
8de6f6c6 38With no flags,
b42074ab 39.Nm sendmail
5412ac7d 40reads its standard input
8e8bec7f
EA
41up to an end-of-file
42or a line consisting only of a single dot
43and sends a copy of the message found there
5412ac7d 44to all of the addresses listed.
8e8bec7f 45It determines the network(s) to use
8de6f6c6 46based on the syntax and contents of the addresses.
b42074ab 47.Pp
5412ac7d 48Local addresses are looked up in a file
5412ac7d
KM
49and aliased appropriately.
50Aliasing can be prevented by preceding the address
8de6f6c6 51with a backslash.
5412ac7d
KM
52Normally the sender is not included in any alias
53expansions, e.g.,
54if `john' sends to `group',
55and `group' includes `john' in the expansion,
56then the letter will not be delivered to `john'.
b42074ab 57.Pp
8de6f6c6 58Flags are:
b42074ab
CL
59.Bl -tag -width Fl
60.It Fl ba
61Go into
62.Tn ARPANET
63mode.
8de6f6c6
KM
64All input lines must end with a CR-LF,
65and all messages will be generated with a CR-LF at the end.
66Also,
67the ``From:'' and ``Sender:''
68fields are examined for the name of the sender.
b42074ab
CL
69.It Fl bd
70Run as a daemon. This requires Berkeley
71.Tn IPC .
72.Nm Sendmail
8e8bec7f 73will fork and run in background
b42074ab
CL
74listening on socket 25 for incoming
75.Tn SMTP
76connections.
8e8bec7f 77This is normally run from
b42074ab
CL
78.Pa /etc/rc .
79.It Fl bi
8de6f6c6 80Initialize the alias database.
b42074ab 81.It Fl bm
8de6f6c6 82Deliver mail in the usual way (default).
b42074ab 83.It Fl bp
8de6f6c6 84Print a listing of the queue.
b42074ab
CL
85.It Fl bs
86Use the
87.Tn SMTP
88protocol as described in
89.Tn RFC821
8e8bec7f 90on standard input and output.
8de6f6c6 91This flag implies all the operations of the
b42074ab
CL
92.Fl ba
93flag that are compatible with
94.Tn SMTP .
95.It Fl bt
8de6f6c6
KM
96Run in address test mode.
97This mode reads addresses and shows the steps in parsing;
98it is used for debugging configuration tables.
b42074ab 99.It Fl bv
8de6f6c6
KM
100Verify names only \- do not try to collect or deliver a message.
101Verify mode is normally used for validating
102users or mailing lists.
b42074ab 103.It Fl bz
8de6f6c6 104Create the configuration freeze file.
b42074ab 105.It Fl C Ns Ar file
8de6f6c6 106Use alternate configuration file.
b42074ab 107.Nm Sendmail
8e8bec7f
EA
108refuses to run as root if an alternate configuration file is specified.
109The frozen configuration file is bypassed.
b42074ab 110.It Fl d Ns Ar X
8de6f6c6 111Set debugging value to
b42074ab
CL
112.Ar X .
113.It Fl F Ns Ar fullname
8de6f6c6 114Set the full name of the sender.
b42074ab 115.It Fl f Ns Ar name
8de6f6c6
KM
116Sets the name of the ``from'' person
117(i.e., the sender of the mail).
b42074ab 118.Fl f
8de6f6c6 119can only be used
8e8bec7f
EA
120by ``trusted'' users
121(normally
b42074ab
CL
122.Em root ,
123.Em daemon ,
5412ac7d 124and
b42074ab 125.Em network )
5412ac7d
KM
126or if the person you are trying to become
127is the same as the person you are.
b42074ab 128.It Fl h Ns Ar N
8de6f6c6 129Set the hop count to
b42074ab 130.Ar N .
8de6f6c6
KM
131The hop count is incremented every time the mail is
132processed.
133When it reaches a limit,
134the mail is returned with an error message,
135the victim of an aliasing loop.
8e8bec7f
EA
136If not specified,
137``Received:'' lines in the message are counted.
b42074ab 138.It Fl n
8de6f6c6 139Don't do aliasing.
b42074ab 140.It Fl o Ns Ar x Em value
8de6f6c6 141Set option
b42074ab 142.Ar x
8de6f6c6 143to the specified
b42074ab 144.Em value .
8de6f6c6 145Options are described below.
b42074ab 146.It Fl q Ns Bq Ar time
8de6f6c6
KM
147Processed saved messages in the queue at given intervals.
148If
b42074ab 149.Ar time
8de6f6c6
KM
150is omitted,
151process the queue once.
b42074ab 152.Xr Time
8de6f6c6 153is given as a tagged number,
b42074ab
CL
154with
155.Ql s
156being seconds,
157.Ql m
158being minutes,
159.Ql h
160being hours,
161.Ql d
162being days,
8de6f6c6 163and
b42074ab
CL
164.Ql w
165being weeks.
8de6f6c6 166For example,
b42074ab
CL
167.Ql \-q1h30m
168or
169.Ql \-q90m
8de6f6c6 170would both set the timeout to one hour thirty minutes.
8e8bec7f 171If
b42074ab 172.Ar time
8e8bec7f 173is specified,
b42074ab 174.Nm sendmail
8e8bec7f
EA
175will run in background.
176This option can be used safely with
b42074ab
CL
177.Fl bd .
178.It Fl r Ns Ar name
8de6f6c6 179An alternate and obsolete form of the
b42074ab 180.Fl f
8de6f6c6 181flag.
b42074ab 182.It Fl t
8de6f6c6 183Read message for recipients.
8e8bec7f 184To:, Cc:, and Bcc: lines will be scanned for recipient addresses.
8de6f6c6 185The Bcc: line will be deleted before transmission.
8e8bec7f
EA
186Any addresses in the argument list will be suppressed,
187that is,
188they will
b42074ab 189.Em not
8e8bec7f 190receive copies even if listed in the message header.
b42074ab 191.It Fl v
8de6f6c6
KM
192Go into verbose mode.
193Alias expansions will be announced, etc.
b42074ab
CL
194.El
195.Pp
8de6f6c6
KM
196There are also a number of processing options that may be set.
197Normally these will only be used by a system administrator.
198Options may be set either on the command line
199using the
b42074ab 200.Fl o
8de6f6c6
KM
201flag
202or in the configuration file.
203These are described in detail in the
e3f16e5f 204.%T "Sendmail Installation and Operation Guide" .
8de6f6c6 205The options are:
b42074ab
CL
206.Bl -tag -width Fl
207.It Li A Ns Ar file
8de6f6c6 208Use alternate alias file.
b42074ab 209.It Li c
8de6f6c6
KM
210On mailers that are considered ``expensive'' to connect to,
211don't initiate immediate connection.
212This requires queueing.
b42074ab 213.It Li d Ns Ar x
8de6f6c6 214Set the delivery mode to
b42074ab 215.Ar x .
8de6f6c6 216Delivery modes are
b42074ab
CL
217.Ql i
218for interactive (synchronous) delivery,
219.Ql b
220for background (asynchronous) delivery,
8de6f6c6 221and
b42074ab
CL
222.Ql q
223for queue only \- i.e.,
8de6f6c6 224actual delivery is done the next time the queue is run.
b42074ab 225.It Li D
8de6f6c6
KM
226Try to automatically rebuild the alias database
227if necessary.
b42074ab 228.It Li e Ns Ar x
8de6f6c6 229Set error processing to mode
b42074ab 230.Ar x .
8de6f6c6 231Valid modes are
b42074ab
CL
232.Ql m
233to mail back the error message,
234.Ql w
235to ``write'' back the error message
8de6f6c6 236(or mail it back if the sender is not logged in),
b42074ab
CL
237.Ql p
238to print the errors on the terminal
8de6f6c6 239(default),
b42074ab
CL
240.Ql q
241to throw away error messages
8de6f6c6 242(only exit status is returned),
b42074ab
CL
243and
244.Ql e
8de6f6c6
KM
245to do special processing for the BerkNet.
246If the text of the message is not mailed back
247by
b42074ab
CL
248modes
249.Ql m
250or
251.Ql w
8de6f6c6
KM
252and if the sender is local to this machine,
253a copy of the message is appended to the file
b42074ab 254.Pa dead.letter
5412ac7d 255in the sender's home directory.
b42074ab 256.It Li F Ns Ar mode
8de6f6c6 257The mode to use when creating temporary files.
b42074ab
CL
258.It Li f
259Save
260.Tn UNIX Ns \-style
261From lines at the front of messages.
262.It Li g Ar N
8de6f6c6 263The default group id to use when calling mailers.
b42074ab
CL
264.It Li H Ns Ar file
265The
266.Tn SMTP
267help file.
268.It Li i
8de6f6c6
KM
269Do not take dots on a line by themselves
270as a message terminator.
030ae776
EA
271.It Li k Ar N
272Checkpoint the queue file after every
273.Ar N
274successful deliveries (default 10).
275This avoids excessive duplicate deliveries
276when sending to long mailing lists
277interrupted by system crashes.
b42074ab 278.It Li L Ns Ar n
8de6f6c6 279The log level.
b42074ab 280.It Li m
8de6f6c6 281Send to ``me'' (the sender) also if I am in an alias expansion.
b42074ab 282.It Li o
8de6f6c6
KM
283If set, this message may have
284old style headers.
285If not set,
286this message is guaranteed to have new style headers
287(i.e., commas instead of spaces between addresses).
288If set, an adaptive algorithm is used that will correctly
289determine the header format in most cases.
b42074ab 290.It Li Q Ns Ar queuedir
8de6f6c6 291Select the directory in which to queue messages.
b42074ab 292.It Li r Ns Ar timeout
8de6f6c6
KM
293The timeout on reads;
294if none is set,
b42074ab 295.Nm sendmail
8de6f6c6 296will wait forever for a mailer.
b42074ab
CL
297This option violates the word (if not the intent) of the
298.Tn SMTP
299specification,
8e8bec7f 300show the timeout should probably be fairly large.
b42074ab 301.It Li S Ns Ar file
8de6f6c6 302Save statistics in the named file.
b42074ab 303.It Li s
8de6f6c6
KM
304Always instantiate the queue file,
305even under circumstances where it is not strictly necessary.
8e8bec7f 306This provides safety against system crashes during delivery.
b42074ab 307.It Li T Ns Ar time
8e8bec7f
EA
308Set the timeout on undelivered messages in the queue to the specified time.
309After delivery has failed
310(e.g., because of a host being down)
311for this amount of time,
312failed messages will be returned to the sender.
8de6f6c6 313The default is three days.
b42074ab 314.It Li t Ns Ar stz , Ar dtz
8de6f6c6 315Set the name of the time zone.
8a12fae4
EA
316.It Li U Ns Ar userdatabase
317If set, a user database is consulted to get forwarding information.
318You can consider this an adjunct to the aliasing mechanism,
319except that the database is intended to be distributed;
320aliases are local to a particular host.
321This may not be available if your sendmail does not have the
322USERDB option compiled in.
b42074ab 323.It Li u Ns Ar N
8de6f6c6 324Set the default user id for mailers.
030ae776
EA
325.It Li w
326If not set, name server lookups will us a querytype of ANY
327to find types
328CNAME, A, and MX,
329and will cause all existing records to be cached by our local server.
330If there is (might be) a wildcard MX in the local domain
331or its parents that are searched, you
332.ul
333must
334set this option, which will use a querytype of CNAME only;
335otherwise, it would cause all fully-qualified names
336to match as names in the local domain.
b42074ab
CL
337.El
338.Pp
8e8bec7f
EA
339In aliases,
340the first character of a name may be
341a vertical bar to cause interpretation of
342the rest of the name as a command
5412ac7d 343to pipe the mail to.
8e8bec7f 344It may be necessary to quote the name
5412ac7d 345to keep
b42074ab 346.Nm sendmail
5412ac7d 347from suppressing the blanks from between arguments.
8e8bec7f 348For example, a common alias is:
b42074ab
CL
349.Pp
350.Bd -literal -offset indent -compact
351msgs: "|/usr/bin/msgs -s"
352.Ed
353.Pp
354Aliases may also have the syntax
355.Dq :include: Ns Ar filename
8e8bec7f 356to ask
b42074ab 357.Xr sendmail
8e8bec7f
EA
358to read the named file for a list of recipients.
359For example, an alias such as:
b42074ab
CL
360.Pp
361.Bd -literal -offset indent -compact
362poets: ":include:/usr/local/lib/poets.list"
363.Ed
364.Pp
8e8bec7f 365would read
b42074ab 366.Pa /usr/local/lib/poets.list
8e8bec7f 367for the list of addresses making up the group.
b42074ab
CL
368.Pp
369.Nm Sendmail
5412ac7d
KM
370returns an exit status
371describing what it did.
8de6f6c6 372The codes are defined in
b42074ab
CL
373.Aq Pa sysexits.h :
374.Bl -tag -width EX_UNAVAILABLE -compact -offset indent
375.It Dv EX_OK
376Successful completion on all addresses.
377.It Dv EX_NOUSER
378User name not recognized.
379.It Dv EX_UNAVAILABLE
380Catchall meaning necessary resources
5412ac7d 381were not available.
b42074ab
CL
382.It Dv EX_SYNTAX
383Syntax error in address.
384.It Dv EX_SOFTWARE
385Internal software error,
5412ac7d 386including bad arguments.
b42074ab
CL
387.It Dv EX_OSERR
388Temporary operating system error,
389such as
390.Dq cannot fork .
391.It Dv EX_NOHOST
392Host name not recognized.
393.It Dv EX_TEMPFAIL
394Message could not be sent immediately,
8de6f6c6 395but was queued.
b42074ab
CL
396.El
397.Pp
8de6f6c6 398If invoked as
b42074ab
CL
399.Nm newaliases ,
400.Nm sendmail
8de6f6c6
KM
401will rebuild the alias database.
402If invoked as
b42074ab
CL
403.Nm mailq ,
404.Nm sendmail
8de6f6c6 405will print the contents of the mail queue.
b42074ab
CL
406.Sh FILES
407Except for the file
408.Pa /etc/sendmail.cf
409itself,
410the following pathnames are all specified in
411.Pa /etc/sendmail.cf.
8de6f6c6
KM
412Thus,
413these values are only approximations.
b42074ab
CL
414.Pp
415.Bl -tag -width /usr/lib/sendmail.fc -compact
416.It Pa /etc/aliases
417raw data for alias names
418.It Pa /etc/aliases.pag
419.It Pa /etc/aliases.dir
420data base of alias names
421.It Pa /etc/sendmail.cf
422configuration file
423.It Pa /etc/sendmail.fc
424frozen configuration
425.It Pa /etc/sendmail.hf
426help file
427.It Pa /var/log/sendmail.st
428collected statistics
429.It Pa /var/spool/mqueue/*
430temp files
431.El
432.Sh SEE ALSO
433.Xr binmail 1 ,
434.Xr mail 1 ,
435.Xr rmail 1 ,
436.Xr syslog 3 ,
437.Xr aliases 5 ,
438.Xr mailaddr 7 ,
439.Xr rc 8 ;
440.Pp
441DARPA
442Internet Request For Comments
443.%T RFC819 ,
444.%T RFC821 ,
445.%T RFC822 .
446.Rs
e3f16e5f 447.%T "Sendmail \- An Internetwork Mail Router"
b42074ab
CL
448.%V SMM
449.%N \&No. 9
450.Re
451.Rs
e3f16e5f 452.%T "Sendmail Installation and Operation Guide"
b42074ab
CL
453.%V SMM
454.%N \&No. 8
455.Re
456.Sh HISTORY
457The
458.Nm
459command appeared in
460.Bx 4.2 .