1.\" Copyright (c) 1988, 1991 The Regents of the University of California.
2.\" All rights reserved.
3.\"
4.\" %sccs.include.redist.man%
5.\"
6.\"     @(#)sendmail.8	6.7 (Berkeley) 04/26/91
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.Pp
58Flags are:
59.Bl -tag -width Fl
60.It Fl ba
61Go into
62.Tn ARPANET
63mode.
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.
69.It Fl bd
70Run as a daemon.  This requires Berkeley
71.Tn IPC .
72.Nm Sendmail
73will fork and run in background
74listening on socket 25 for incoming
75.Tn SMTP
76connections.
77This is normally run from
78.Pa /etc/rc .
79.It Fl bi
80Initialize the alias database.
81.It Fl bm
82Deliver mail in the usual way (default).
83.It Fl bp
84Print a listing of the queue.
85.It Fl bs
86Use the
87.Tn SMTP
88protocol as described in
89.Tn RFC821
90on standard input and output.
91This flag implies all the operations of the
92.Fl ba
93flag that are compatible with
94.Tn SMTP .
95.It Fl bt
96Run in address test mode.
97This mode reads addresses and shows the steps in parsing;
98it is used for debugging configuration tables.
99.It Fl bv
100Verify names only \- do not try to collect or deliver a message.
101Verify mode is normally used for validating
102users or mailing lists.
103.It Fl bz
104Create the configuration freeze file.
105.It Fl C Ns Ar file
106Use alternate configuration file.
107.Nm Sendmail
108refuses to run as root if an alternate configuration file is specified.
109The frozen configuration file is bypassed.
110.It Fl d Ns Ar X
111Set debugging value to
112.Ar X .
113.It Fl F Ns Ar fullname
114Set the full name of the sender.
115.It Fl f Ns Ar name
116Sets the name of the ``from'' person
117(i.e., the sender of the mail).
118.Fl f
119can only be used
120by ``trusted'' users
121(normally
122.Em root ,
123.Em daemon ,
124and
125.Em network )
126or if the person you are trying to become
127is the same as the person you are.
128.It Fl h Ns Ar N
129Set the hop count to
130.Ar N .
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.
136If not specified,
137``Received:'' lines in the message are counted.
138.It Fl k Ar N
139Checkpoint the queue file after every
140.Ar N
141successful deliveries (default 10).
142This avoids excessive duplicate deliveries
143when sending to long mailing lists
144interrupted by system crashes.
145.It Fl n
146Don't do aliasing.
147.It Fl o Ns Ar x Em value
148Set option
149.Ar x
150to the specified
151.Em value .
152Options are described below.
153.It Fl q Ns Bq Ar time
154Processed saved messages in the queue at given intervals.
155If
156.Ar time
157is omitted,
158process the queue once.
159.Xr Time
160is given as a tagged number,
161with
162.Ql s
163being seconds,
164.Ql m
165being minutes,
166.Ql h
167being hours,
168.Ql d
169being days,
170and
171.Ql w
172being weeks.
173For example,
174.Ql \-q1h30m
175or
176.Ql \-q90m
177would both set the timeout to one hour thirty minutes.
178If
179.Ar time
180is specified,
181.Nm sendmail
182will run in background.
183This option can be used safely with
184.Fl bd .
185.It Fl r Ns Ar name
186An alternate and obsolete form of the
187.Fl f
188flag.
189.It Fl t
190Read message for recipients.
191To:, Cc:, and Bcc: lines will be scanned for recipient addresses.
192The Bcc: line will be deleted before transmission.
193Any addresses in the argument list will be suppressed,
194that is,
195they will
196.Em not
197receive copies even if listed in the message header.
198.It Fl v
199Go into verbose mode.
200Alias expansions will be announced, etc.
201.El
202.Pp
203There are also a number of processing options that may be set.
204Normally these will only be used by a system administrator.
205Options may be set either on the command line
206using the
207.Fl o
208flag
209or in the configuration file.
210These are described in detail in the
211.%T "Sendmail Installation and Operation Guide" .
212The options are:
213.Bl -tag -width Fl
214.It Li A Ns Ar file
215Use alternate alias file.
216.It Li c
217On mailers that are considered ``expensive'' to connect to,
218don't initiate immediate connection.
219This requires queueing.
220.It Li d Ns Ar x
221Set the delivery mode to
222.Ar x .
223Delivery modes are
224.Ql i
225for interactive (synchronous) delivery,
226.Ql b
227for background (asynchronous) delivery,
228and
229.Ql q
230for queue only \- i.e.,
231actual delivery is done the next time the queue is run.
232.It Li D
233Try to automatically rebuild the alias database
234if necessary.
235.It Li e Ns Ar x
236Set error processing to mode
237.Ar x .
238Valid modes are
239.Ql m
240to mail back the error message,
241.Ql w
242to ``write'' back the error message
243(or mail it back if the sender is not logged in),
244.Ql p
245to print the errors on the terminal
246(default),
247.Ql q
248to throw away error messages
249(only exit status is returned),
250and
251.Ql e
252to do special processing for the BerkNet.
253If the text of the message is not mailed back
254by
255modes
256.Ql m
257or
258.Ql w
259and if the sender is local to this machine,
260a copy of the message is appended to the file
261.Pa dead.letter
262in the sender's home directory.
263.It Li F Ns Ar mode
264The mode to use when creating temporary files.
265.It Li f
266Save
267.Tn UNIX Ns \-style
268From lines at the front of messages.
269.It Li g Ar N
270The default group id to use when calling mailers.
271.It Li H Ns Ar file
272The
273.Tn SMTP
274help file.
275.It Li i
276Do not take dots on a line by themselves
277as a message terminator.
278.It Li L Ns Ar n
279The log level.
280.It Li m
281Send to ``me'' (the sender) also if I am in an alias expansion.
282.It Li o
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.
290.It Li Q Ns Ar queuedir
291Select the directory in which to queue messages.
292.It Li r Ns Ar timeout
293The timeout on reads;
294if none is set,
295.Nm sendmail
296will wait forever for a mailer.
297This option violates the word (if not the intent) of the
298.Tn SMTP
299specification,
300show the timeout should probably be fairly large.
301.It Li S Ns Ar file
302Save statistics in the named file.
303.It Li s
304Always instantiate the queue file,
305even under circumstances where it is not strictly necessary.
306This provides safety against system crashes during delivery.
307.It Li T Ns Ar time
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.
313The default is three days.
314.It Li t Ns Ar stz , Ar dtz
315Set the name of the time zone.
316.It Li u Ns Ar N
317Set the default user id for mailers.
318.El
319.Pp
320In aliases,
321the first character of a name may be
322a vertical bar to cause interpretation of
323the rest of the name as a command
324to pipe the mail to.
325It may be necessary to quote the name
326to keep
327.Nm sendmail
328from suppressing the blanks from between arguments.
329For example, a common alias is:
330.Pp
331.Bd -literal -offset indent -compact
332msgs: "|/usr/bin/msgs -s"
333.Ed
334.Pp
335Aliases may also have the syntax
336.Dq :include: Ns Ar filename
337to ask
338.Xr sendmail
339to read the named file for a list of recipients.
340For example, an alias such as:
341.Pp
342.Bd -literal -offset indent -compact
343poets: ":include:/usr/local/lib/poets.list"
344.Ed
345.Pp
346would read
347.Pa /usr/local/lib/poets.list
348for the list of addresses making up the group.
349.Pp
350.Nm Sendmail
351returns an exit status
352describing what it did.
353The codes are defined in
354.Aq Pa sysexits.h :
355.Bl -tag -width EX_UNAVAILABLE -compact -offset indent
356.It Dv EX_OK
357Successful completion on all addresses.
358.It Dv EX_NOUSER
359User name not recognized.
360.It Dv EX_UNAVAILABLE
361Catchall meaning necessary resources
362were not available.
363.It Dv EX_SYNTAX
364Syntax error in address.
365.It Dv EX_SOFTWARE
366Internal software error,
367including bad arguments.
368.It Dv EX_OSERR
369Temporary operating system error,
370such as
371.Dq cannot fork .
372.It Dv EX_NOHOST
373Host name not recognized.
374.It Dv EX_TEMPFAIL
375Message could not be sent immediately,
376but was queued.
377.El
378.Pp
379If invoked as
380.Nm newaliases ,
381.Nm sendmail
382will rebuild the alias database.
383If invoked as
384.Nm mailq ,
385.Nm sendmail
386will print the contents of the mail queue.
387.Sh FILES
388Except for the file
389.Pa /etc/sendmail.cf
390itself,
391the following pathnames are all specified in
392.Pa /etc/sendmail.cf.
393Thus,
394these values are only approximations.
395.Pp
396.Bl -tag -width /usr/lib/sendmail.fc -compact
397.It Pa /etc/aliases
398raw data for alias names
399.It Pa /etc/aliases.pag
400.It Pa /etc/aliases.dir
401data base of alias names
402.It Pa /etc/sendmail.cf
403configuration file
404.It Pa /etc/sendmail.fc
405frozen configuration
406.It Pa /etc/sendmail.hf
407help file
408.It Pa /var/log/sendmail.st
409collected statistics
410.It Pa /var/spool/mqueue/*
411temp files
412.El
413.Sh SEE ALSO
414.Xr binmail 1 ,
415.Xr mail 1 ,
416.Xr rmail 1 ,
417.Xr syslog 3 ,
418.Xr aliases 5 ,
419.Xr mailaddr 7 ,
420.Xr rc 8 ;
421.Pp
422DARPA
423Internet Request For Comments
424.%T RFC819 ,
425.%T RFC821 ,
426.%T RFC822 .
427.Rs
428.%T "Sendmail \- An Internetwork Mail Router"
429.%V SMM
430.%N \&No. 9
431.Re
432.Rs
433.%T "Sendmail Installation and Operation Guide"
434.%V SMM
435.%N \&No. 8
436.Re
437.Sh HISTORY
438The
439.Nm
440command appeared in
441.Bx 4.2 .
442