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.12 (Berkeley) 10/03/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 n
139Don't do aliasing.
140.It Fl o Ns Ar x Em value
141Set option
142.Ar x
143to the specified
144.Em value .
145Options are described below.
146.It Fl q Ns Bq Ar time
147Processed saved messages in the queue at given intervals.
148If
149.Ar time
150is omitted,
151process the queue once.
152.Xr Time
153is given as a tagged number,
154with
155.Ql s
156being seconds,
157.Ql m
158being minutes,
159.Ql h
160being hours,
161.Ql d
162being days,
163and
164.Ql w
165being weeks.
166For example,
167.Ql \-q1h30m
168or
169.Ql \-q90m
170would both set the timeout to one hour thirty minutes.
171If
172.Ar time
173is specified,
174.Nm sendmail
175will run in background.
176This option can be used safely with
177.Fl bd .
178.It Fl r Ns Ar name
179An alternate and obsolete form of the
180.Fl f
181flag.
182.It Fl t
183Read message for recipients.
184To:, Cc:, and Bcc: lines will be scanned for recipient addresses.
185The Bcc: line will be deleted before transmission.
186Any addresses in the argument list will be suppressed,
187that is,
188they will
189.Em not
190receive copies even if listed in the message header.
191.It Fl v
192Go into verbose mode.
193Alias expansions will be announced, etc.
194.El
195.Pp
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
200.Fl o
201flag
202or in the configuration file.
203These are described in detail in the
204.%T "Sendmail Installation and Operation Guide" .
205The options are:
206.Bl -tag -width Fl
207.It Li A Ns Ar file
208Use alternate alias file.
209.It Li c
210On mailers that are considered ``expensive'' to connect to,
211don't initiate immediate connection.
212This requires queueing.
213.It Li C Ar N
214Checkpoint the queue file after every
215.Ar N
216successful deliveries (default 10).
217This avoids excessive duplicate deliveries
218when sending to long mailing lists
219interrupted by system crashes.
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 h Ar N
276The maximum number of times a message is allowed to ``hop''
277before we decide it is in a loop.
278.It Li i
279Do not take dots on a line by themselves
280as a message terminator.
281.It Li L Ns Ar n
282The log level.
283.It Li m
284Send to ``me'' (the sender) also if I am in an alias expansion.
285.It Li o
286If set, this message may have
287old style headers.
288If not set,
289this message is guaranteed to have new style headers
290(i.e., commas instead of spaces between addresses).
291If set, an adaptive algorithm is used that will correctly
292determine the header format in most cases.
293.It Li Q Ns Ar queuedir
294Select the directory in which to queue messages.
295.It Li r Ns Ar timeout
296The timeout on reads;
297if none is set,
298.Nm sendmail
299will wait forever for a mailer.
300This option violates the word (if not the intent) of the
301.Tn SMTP
302specification,
303show the timeout should probably be fairly large.
304.It Li S Ns Ar file
305Save statistics in the named file.
306.It Li s
307Always instantiate the queue file,
308even under circumstances where it is not strictly necessary.
309This provides safety against system crashes during delivery.
310.It Li T Ns Ar time
311Set the timeout on undelivered messages in the queue to the specified time.
312After delivery has failed
313(e.g., because of a host being down)
314for this amount of time,
315failed messages will be returned to the sender.
316The default is three days.
317.It Li t Ns Ar stz , Ar dtz
318Set the name of the time zone.
319.It Li U Ns Ar userdatabase
320If set, a user database is consulted to get forwarding information.
321You can consider this an adjunct to the aliasing mechanism,
322except that the database is intended to be distributed;
323aliases are local to a particular host.
324This may not be available if your sendmail does not have the
325.Dv USERDB
326option compiled in.
327.It Li u Ns Ar N
328Set the default user id for mailers.
329.It Li w
330If set, name server lookups will us a querytype of ANY
331to find types
332.Dv CNAME , A ,
333and
334.Dv MX ,
335and will cause all existing records to be cached by our local server.
336If you are certain that there are no wildcard MX records in the local domain
337or its parents that are searched, you can
338set this option.
339If the option is not set,
340name server lookups will use a querytype of
341.Dv CNAME
342only;
343otherwise, it would cause all fully-qualified names
344to match as names in the local domain.
345.El
346.Pp
347In aliases,
348the first character of a name may be
349a vertical bar to cause interpretation of
350the rest of the name as a command
351to pipe the mail to.
352It may be necessary to quote the name
353to keep
354.Nm sendmail
355from suppressing the blanks from between arguments.
356For example, a common alias is:
357.Pp
358.Bd -literal -offset indent -compact
359msgs: "|/usr/bin/msgs -s"
360.Ed
361.Pp
362Aliases may also have the syntax
363.Dq :include: Ns Ar filename
364to ask
365.Xr sendmail
366to read the named file for a list of recipients.
367For example, an alias such as:
368.Pp
369.Bd -literal -offset indent -compact
370poets: ":include:/usr/local/lib/poets.list"
371.Ed
372.Pp
373would read
374.Pa /usr/local/lib/poets.list
375for the list of addresses making up the group.
376.Pp
377.Nm Sendmail
378returns an exit status
379describing what it did.
380The codes are defined in
381.Aq Pa sysexits.h :
382.Bl -tag -width EX_UNAVAILABLE -compact -offset indent
383.It Dv EX_OK
384Successful completion on all addresses.
385.It Dv EX_NOUSER
386User name not recognized.
387.It Dv EX_UNAVAILABLE
388Catchall meaning necessary resources
389were not available.
390.It Dv EX_SYNTAX
391Syntax error in address.
392.It Dv EX_SOFTWARE
393Internal software error,
394including bad arguments.
395.It Dv EX_OSERR
396Temporary operating system error,
397such as
398.Dq cannot fork .
399.It Dv EX_NOHOST
400Host name not recognized.
401.It Dv EX_TEMPFAIL
402Message could not be sent immediately,
403but was queued.
404.El
405.Pp
406If invoked as
407.Nm newaliases ,
408.Nm sendmail
409will rebuild the alias database.
410If invoked as
411.Nm mailq ,
412.Nm sendmail
413will print the contents of the mail queue.
414.Sh FILES
415Except for the file
416.Pa /etc/sendmail.cf
417itself,
418the following pathnames are all specified in
419.Pa /etc/sendmail.cf.
420Thus,
421these values are only approximations.
422.Pp
423.Bl -tag -width /usr/lib/sendmail.fc -compact
424.It Pa /etc/aliases
425raw data for alias names
426.It Pa /etc/aliases.pag
427.It Pa /etc/aliases.dir
428data base of alias names
429.It Pa /etc/sendmail.cf
430configuration file
431.It Pa /etc/sendmail.fc
432frozen configuration
433.It Pa /etc/sendmail.hf
434help file
435.It Pa /var/log/sendmail.st
436collected statistics
437.It Pa /var/spool/mqueue/*
438temp files
439.El
440.Sh SEE ALSO
441.Xr binmail 1 ,
442.Xr mail 1 ,
443.Xr rmail 1 ,
444.Xr syslog 3 ,
445.Xr aliases 5 ,
446.Xr mailaddr 7 ,
447.Xr rc 8 ;
448.Pp
449DARPA
450Internet Request For Comments
451.%T RFC819 ,
452.%T RFC821 ,
453.%T RFC822 .
454.Rs
455.%T "Sendmail \- An Internetwork Mail Router"
456.%V SMM
457.%N \&No. 9
458.Re
459.Rs
460.%T "Sendmail Installation and Operation Guide"
461.%V SMM
462.%N \&No. 8
463.Re
464.Sh HISTORY
465The
466.Nm
467command appeared in
468.Bx 4.2 .
469