Changed return value of setgrent from int to void.
[unix-history] / usr.sbin / sendmail / src / sendmail.8
CommitLineData
6f14531a
RG
1.\" Copyright (c) 1988, 1991, 1993
2.\" The Regents of the University of California. All rights reserved.
15637ed4
RG
3.\"
4.\" Redistribution and use in source and binary forms, with or without
5.\" modification, are permitted provided that the following conditions
6.\" are met:
7.\" 1. Redistributions of source code must retain the above copyright
8.\" notice, this list of conditions and the following disclaimer.
9.\" 2. Redistributions in binary form must reproduce the above copyright
10.\" notice, this list of conditions and the following disclaimer in the
11.\" documentation and/or other materials provided with the distribution.
12.\" 3. All advertising materials mentioning features or use of this software
13.\" must display the following acknowledgement:
14.\" This product includes software developed by the University of
15.\" California, Berkeley and its contributors.
16.\" 4. Neither the name of the University nor the names of its contributors
17.\" may be used to endorse or promote products derived from this software
18.\" without specific prior written permission.
19.\"
20.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
21.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
22.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
23.\" ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
24.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
25.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
26.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
27.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
28.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
29.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
30.\" SUCH DAMAGE.
31.\"
3a363396 32.\" @(#)sendmail.8 8.2 (Berkeley) 7/11/93
15637ed4 33.\"
3a363396 34.Dd July 11, 1993
15637ed4
RG
35.Dt SENDMAIL 8
36.Os BSD 4
37.Sh NAME
38.Nm sendmail
39.Nd send mail over the internet
40.Sh SYNOPSIS
41.Nm sendmail
42.Op Ar flags
43.Op Ar address ...
44.Nm newaliases
45.Nm mailq
46.Op Fl v
47.Sh DESCRIPTION
48.Nm Sendmail
49sends a message to one or more
50.Em recipients ,
51routing the message over whatever networks
52are necessary.
53.Nm Sendmail
54does internetwork forwarding as necessary
55to deliver the message to the correct place.
56.Pp
57.Nm Sendmail
58is not intended as a user interface routine;
59other programs provide user-friendly
60front ends;
61.Nm sendmail
62is used only to deliver pre-formatted messages.
63.Pp
64With no flags,
65.Nm sendmail
66reads its standard input
67up to an end-of-file
68or a line consisting only of a single dot
69and sends a copy of the message found there
70to all of the addresses listed.
71It determines the network(s) to use
72based on the syntax and contents of the addresses.
73.Pp
74Local addresses are looked up in a file
75and aliased appropriately.
76Aliasing can be prevented by preceding the address
77with a backslash.
78Normally the sender is not included in any alias
79expansions, e.g.,
80if `john' sends to `group',
81and `group' includes `john' in the expansion,
82then the letter will not be delivered to `john'.
6f14531a 83.Ss Parameters
15637ed4 84.Bl -tag -width Fl
6f14531a
RG
85.It Fl B Ns Ar type
86Set the body type to
87.Ar type .
88Current legal values
89.Li 7BIT
90or
91.Li 8BITMIME .
15637ed4
RG
92.It Fl ba
93Go into
94.Tn ARPANET
95mode.
96All input lines must end with a CR-LF,
97and all messages will be generated with a CR-LF at the end.
98Also,
99the ``From:'' and ``Sender:''
100fields are examined for the name of the sender.
101.It Fl bd
102Run as a daemon. This requires Berkeley
103.Tn IPC .
104.Nm Sendmail
105will fork and run in background
106listening on socket 25 for incoming
107.Tn SMTP
108connections.
109This is normally run from
110.Pa /etc/rc .
111.It Fl bi
112Initialize the alias database.
113.It Fl bm
114Deliver mail in the usual way (default).
115.It Fl bp
116Print a listing of the queue.
117.It Fl bs
118Use the
119.Tn SMTP
120protocol as described in
121.Tn RFC821
122on standard input and output.
123This flag implies all the operations of the
124.Fl ba
125flag that are compatible with
126.Tn SMTP .
127.It Fl bt
128Run in address test mode.
129This mode reads addresses and shows the steps in parsing;
130it is used for debugging configuration tables.
131.It Fl bv
132Verify names only \- do not try to collect or deliver a message.
133Verify mode is normally used for validating
134users or mailing lists.
135.It Fl bz
136Create the configuration freeze file.
137.It Fl C Ns Ar file
138Use alternate configuration file.
139.Nm Sendmail
140refuses to run as root if an alternate configuration file is specified.
141The frozen configuration file is bypassed.
142.It Fl d Ns Ar X
143Set debugging value to
144.Ar X .
145.It Fl F Ns Ar fullname
146Set the full name of the sender.
147.It Fl f Ns Ar name
148Sets the name of the ``from'' person
149(i.e., the sender of the mail).
150.Fl f
151can only be used
152by ``trusted'' users
153(normally
154.Em root ,
155.Em daemon ,
156and
157.Em network )
158or if the person you are trying to become
159is the same as the person you are.
160.It Fl h Ns Ar N
161Set the hop count to
162.Ar N .
163The hop count is incremented every time the mail is
164processed.
165When it reaches a limit,
166the mail is returned with an error message,
167the victim of an aliasing loop.
168If not specified,
169``Received:'' lines in the message are counted.
170.It Fl n
171Don't do aliasing.
172.It Fl o Ns Ar x Em value
173Set option
174.Ar x
175to the specified
176.Em value .
177Options are described below.
6f14531a
RG
178.It Fl p Ns Ar protocol
179Set the name of the protocol used to receive the message.
180This can be a simple protocol name such as ``UUCP''
181or a protocol and hostname, such as ``UUCP:ucbvax''.
15637ed4
RG
182.It Fl q Ns Bq Ar time
183Processed saved messages in the queue at given intervals.
184If
185.Ar time
186is omitted,
187process the queue once.
188.Xr Time
189is given as a tagged number,
190with
191.Ql s
192being seconds,
193.Ql m
194being minutes,
195.Ql h
196being hours,
197.Ql d
198being days,
199and
200.Ql w
201being weeks.
202For example,
203.Ql \-q1h30m
204or
205.Ql \-q90m
206would both set the timeout to one hour thirty minutes.
207If
208.Ar time
209is specified,
210.Nm sendmail
211will run in background.
212This option can be used safely with
213.Fl bd .
214.It Fl r Ns Ar name
215An alternate and obsolete form of the
216.Fl f
217flag.
218.It Fl t
219Read message for recipients.
220To:, Cc:, and Bcc: lines will be scanned for recipient addresses.
221The Bcc: line will be deleted before transmission.
222Any addresses in the argument list will be suppressed,
223that is,
224they will
225.Em not
226receive copies even if listed in the message header.
227.It Fl v
228Go into verbose mode.
229Alias expansions will be announced, etc.
3a363396
NW
230.It Fl X Ar logfile
231Log all traffic in and out of mailers in the indicated log file.
232This should only be used as a last resort
233for debugging mailer bugs.
234It will log a lot of data very quickly.
15637ed4 235.El
6f14531a 236.Ss Options
15637ed4
RG
237There are also a number of processing options that may be set.
238Normally these will only be used by a system administrator.
239Options may be set either on the command line
240using the
241.Fl o
242flag
243or in the configuration file.
6f14531a
RG
244This is a partial list;
245for a complete list (and details), consult the
15637ed4
RG
246.%T "Sendmail Installation and Operation Guide" .
247The options are:
248.Bl -tag -width Fl
249.It Li A Ns Ar file
250Use alternate alias file.
6f14531a
RG
251.It Li b Ns Ar nblocks
252The minimum number of free blocks needed on the spool filesystem.
15637ed4
RG
253.It Li c
254On mailers that are considered ``expensive'' to connect to,
255don't initiate immediate connection.
256This requires queueing.
6f14531a
RG
257.It Li C Ar N
258Checkpoint the queue file after every
259.Ar N
260successful deliveries (default 10).
261This avoids excessive duplicate deliveries
262when sending to long mailing lists
263interrupted by system crashes.
15637ed4
RG
264.It Li d Ns Ar x
265Set the delivery mode to
266.Ar x .
267Delivery modes are
268.Ql i
269for interactive (synchronous) delivery,
270.Ql b
271for background (asynchronous) delivery,
272and
273.Ql q
274for queue only \- i.e.,
275actual delivery is done the next time the queue is run.
276.It Li D
277Try to automatically rebuild the alias database
278if necessary.
279.It Li e Ns Ar x
280Set error processing to mode
281.Ar x .
282Valid modes are
283.Ql m
284to mail back the error message,
285.Ql w
286to ``write'' back the error message
287(or mail it back if the sender is not logged in),
288.Ql p
289to print the errors on the terminal
290(default),
291.Ql q
292to throw away error messages
293(only exit status is returned),
294and
295.Ql e
296to do special processing for the BerkNet.
297If the text of the message is not mailed back
298by
299modes
300.Ql m
301or
302.Ql w
303and if the sender is local to this machine,
304a copy of the message is appended to the file
305.Pa dead.letter
306in the sender's home directory.
15637ed4
RG
307.It Li f
308Save
309.Tn UNIX Ns \-style
310From lines at the front of messages.
6f14531a
RG
311.It Li G
312Match local mail names against the GECOS portion of the password file.
15637ed4
RG
313.It Li g Ar N
314The default group id to use when calling mailers.
315.It Li H Ns Ar file
316The
317.Tn SMTP
318help file.
6f14531a
RG
319.It Li h Ar N
320The maximum number of times a message is allowed to ``hop''
321before we decide it is in a loop.
15637ed4
RG
322.It Li i
323Do not take dots on a line by themselves
324as a message terminator.
6f14531a
RG
325.It Li j
326Send error messages in MIME format.
327.It Li K Ns Ar timeout
328Set connection cache timeout.
329.It Li k Ns Ar N
330Set connection cache size.
15637ed4
RG
331.It Li L Ns Ar n
332The log level.
6f14531a
RG
333.It Li l
334Pay attention to the Errors-To: header.
15637ed4
RG
335.It Li m
336Send to ``me'' (the sender) also if I am in an alias expansion.
6f14531a
RG
337.It Li n
338Validate the right hand side of aliases during a
339.Xr newaliases 1
340command.
15637ed4
RG
341.It Li o
342If set, this message may have
343old style headers.
344If not set,
345this message is guaranteed to have new style headers
346(i.e., commas instead of spaces between addresses).
347If set, an adaptive algorithm is used that will correctly
348determine the header format in most cases.
349.It Li Q Ns Ar queuedir
350Select the directory in which to queue messages.
15637ed4
RG
351.It Li S Ns Ar file
352Save statistics in the named file.
353.It Li s
354Always instantiate the queue file,
355even under circumstances where it is not strictly necessary.
356This provides safety against system crashes during delivery.
357.It Li T Ns Ar time
358Set the timeout on undelivered messages in the queue to the specified time.
359After delivery has failed
360(e.g., because of a host being down)
361for this amount of time,
362failed messages will be returned to the sender.
363The default is three days.
364.It Li t Ns Ar stz , Ar dtz
365Set the name of the time zone.
366.It Li U Ns Ar userdatabase
367If set, a user database is consulted to get forwarding information.
368You can consider this an adjunct to the aliasing mechanism,
369except that the database is intended to be distributed;
370aliases are local to a particular host.
371This may not be available if your sendmail does not have the
372.Dv USERDB
373option compiled in.
374.It Li u Ns Ar N
375Set the default user id for mailers.
6f14531a
RG
376.It Li Y
377Fork each job during queue runs.
378May be convenient on memory-poor machines.
379.It Li 7
380Strip incoming messages to seven bits.
15637ed4
RG
381.El
382.Pp
383In aliases,
384the first character of a name may be
385a vertical bar to cause interpretation of
386the rest of the name as a command
387to pipe the mail to.
388It may be necessary to quote the name
389to keep
390.Nm sendmail
391from suppressing the blanks from between arguments.
392For example, a common alias is:
393.Pp
394.Bd -literal -offset indent -compact
395msgs: "|/usr/bin/msgs -s"
396.Ed
397.Pp
398Aliases may also have the syntax
399.Dq :include: Ns Ar filename
400to ask
401.Xr sendmail
402to read the named file for a list of recipients.
403For example, an alias such as:
404.Pp
405.Bd -literal -offset indent -compact
406poets: ":include:/usr/local/lib/poets.list"
407.Ed
408.Pp
409would read
410.Pa /usr/local/lib/poets.list
411for the list of addresses making up the group.
412.Pp
413.Nm Sendmail
414returns an exit status
415describing what it did.
416The codes are defined in
417.Aq Pa sysexits.h :
418.Bl -tag -width EX_UNAVAILABLE -compact -offset indent
419.It Dv EX_OK
420Successful completion on all addresses.
421.It Dv EX_NOUSER
422User name not recognized.
423.It Dv EX_UNAVAILABLE
424Catchall meaning necessary resources
425were not available.
426.It Dv EX_SYNTAX
427Syntax error in address.
428.It Dv EX_SOFTWARE
429Internal software error,
430including bad arguments.
431.It Dv EX_OSERR
432Temporary operating system error,
433such as
434.Dq cannot fork .
435.It Dv EX_NOHOST
436Host name not recognized.
437.It Dv EX_TEMPFAIL
438Message could not be sent immediately,
439but was queued.
440.El
441.Pp
442If invoked as
443.Nm newaliases ,
444.Nm sendmail
445will rebuild the alias database.
446If invoked as
447.Nm mailq ,
448.Nm sendmail
449will print the contents of the mail queue.
450.Sh FILES
451Except for the file
452.Pa /etc/sendmail.cf
453itself,
454the following pathnames are all specified in
455.Pa /etc/sendmail.cf.
456Thus,
457these values are only approximations.
458.Pp
459.Bl -tag -width /usr/lib/sendmail.fc -compact
460.It Pa /etc/aliases
461raw data for alias names
6f14531a 462.It Pa /etc/aliases.db
15637ed4
RG
463data base of alias names
464.It Pa /etc/sendmail.cf
465configuration file
466.It Pa /etc/sendmail.fc
467frozen configuration
468.It Pa /etc/sendmail.hf
469help file
470.It Pa /var/log/sendmail.st
471collected statistics
472.It Pa /var/spool/mqueue/*
473temp files
6f14531a
RG
474.It Pa /var/run/sendmail.pid
475The process id of the daemon
15637ed4
RG
476.El
477.Sh SEE ALSO
478.Xr binmail 1 ,
479.Xr mail 1 ,
480.Xr rmail 1 ,
481.Xr syslog 3 ,
482.Xr aliases 5 ,
483.Xr mailaddr 7 ,
484.Xr rc 8 ;
485.Pp
486DARPA
487Internet Request For Comments
488.%T RFC819 ,
489.%T RFC821 ,
490.%T RFC822 .
491.Rs
492.%T "Sendmail \- An Internetwork Mail Router"
493.%V SMM
494.%N \&No. 16
495.Re
496.Rs
497.%T "Sendmail Installation and Operation Guide"
498.%V SMM
499.%N \&No. 7
500.Re
501.Sh HISTORY
502The
503.Nm
504command appeared in
505.Bx 4.2 .