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