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