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.2 (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.It Fl X Ar logfile
205Log all traffic in and out of mailers in the indicated log file.
206This should only be used as a last resort
207for debugging mailer bugs.
208It will log a lot of data very quickly.
209.El
210.Ss Options
211There are also a number of processing options that may be set.
212Normally these will only be used by a system administrator.
213Options may be set either on the command line
214using the
215.Fl o
216flag
217or in the configuration file.
218This is a partial list;
219for a complete list (and details), consult the
220.%T "Sendmail Installation and Operation Guide" .
221The options are:
222.Bl -tag -width Fl
223.It Li A Ns Ar file
224Use alternate alias file.
225.It Li b Ns Ar nblocks
226The minimum number of free blocks needed on the spool filesystem.
227.It Li c
228On mailers that are considered ``expensive'' to connect to,
229don't initiate immediate connection.
230This requires queueing.
231.It Li C Ar N
232Checkpoint the queue file after every
233.Ar N
234successful deliveries (default 10).
235This avoids excessive duplicate deliveries
236when sending to long mailing lists
237interrupted by system crashes.
238.It Li d Ns Ar x
239Set the delivery mode to
240.Ar x .
241Delivery modes are
242.Ql i
243for interactive (synchronous) delivery,
244.Ql b
245for background (asynchronous) delivery,
246and
247.Ql q
248for queue only \- i.e.,
249actual delivery is done the next time the queue is run.
250.It Li D
251Try to automatically rebuild the alias database
252if necessary.
253.It Li e Ns Ar x
254Set error processing to mode
255.Ar x .
256Valid modes are
257.Ql m
258to mail back the error message,
259.Ql w
260to ``write'' back the error message
261(or mail it back if the sender is not logged in),
262.Ql p
263to print the errors on the terminal
264(default),
265.Ql q
266to throw away error messages
267(only exit status is returned),
268and
269.Ql e
270to do special processing for the BerkNet.
271If the text of the message is not mailed back
272by
273modes
274.Ql m
275or
276.Ql w
277and if the sender is local to this machine,
278a copy of the message is appended to the file
279.Pa dead.letter
280in the sender's home directory.
281.It Li f
282Save
283.Tn UNIX Ns \-style
284From lines at the front of messages.
285.It Li G
286Match local mail names against the GECOS portion of the password file.
287.It Li g Ar N
288The default group id to use when calling mailers.
289.It Li H Ns Ar file
290The
291.Tn SMTP
292help file.
293.It Li h Ar N
294The maximum number of times a message is allowed to ``hop''
295before we decide it is in a loop.
296.It Li i
297Do not take dots on a line by themselves
298as a message terminator.
299.It Li j
300Send error messages in MIME format.
301.It Li K Ns Ar timeout
302Set connection cache timeout.
303.It Li k Ns Ar N
304Set connection cache size.
305.It Li L Ns Ar n
306The log level.
307.It Li l
308Pay attention to the Errors-To: header.
309.It Li m
310Send to ``me'' (the sender) also if I am in an alias expansion.
311.It Li n
312Validate the right hand side of aliases during a
313.Xr newaliases 1
314command.
315.It Li o
316If set, this message may have
317old style headers.
318If not set,
319this message is guaranteed to have new style headers
320(i.e., commas instead of spaces between addresses).
321If set, an adaptive algorithm is used that will correctly
322determine the header format in most cases.
323.It Li Q Ns Ar queuedir
324Select the directory in which to queue messages.
325.It Li S Ns Ar file
326Save statistics in the named file.
327.It Li s
328Always instantiate the queue file,
329even under circumstances where it is not strictly necessary.
330This provides safety against system crashes during delivery.
331.It Li T Ns Ar time
332Set the timeout on undelivered messages in the queue to the specified time.
333After delivery has failed
334(e.g., because of a host being down)
335for this amount of time,
336failed messages will be returned to the sender.
337The default is three days.
338.It Li t Ns Ar stz , Ar dtz
339Set the name of the time zone.
340.It Li U Ns Ar userdatabase
341If set, a user database is consulted to get forwarding information.
342You can consider this an adjunct to the aliasing mechanism,
343except that the database is intended to be distributed;
344aliases are local to a particular host.
345This may not be available if your sendmail does not have the
346.Dv USERDB
347option compiled in.
348.It Li u Ns Ar N
349Set the default user id for mailers.
350.It Li Y
351Fork each job during queue runs.
352May be convenient on memory-poor machines.
353.It Li 7
354Strip incoming messages to seven bits.
355.El
356.Pp
357In aliases,
358the first character of a name may be
359a vertical bar to cause interpretation of
360the rest of the name as a command
361to pipe the mail to.
362It may be necessary to quote the name
363to keep
364.Nm sendmail
365from suppressing the blanks from between arguments.
366For example, a common alias is:
367.Pp
368.Bd -literal -offset indent -compact
369msgs: "|/usr/bin/msgs -s"
370.Ed
371.Pp
372Aliases may also have the syntax
373.Dq :include: Ns Ar filename
374to ask
375.Xr sendmail
376to read the named file for a list of recipients.
377For example, an alias such as:
378.Pp
379.Bd -literal -offset indent -compact
380poets: ":include:/usr/local/lib/poets.list"
381.Ed
382.Pp
383would read
384.Pa /usr/local/lib/poets.list
385for the list of addresses making up the group.
386.Pp
387.Nm Sendmail
388returns an exit status
389describing what it did.
390The codes are defined in
391.Aq Pa sysexits.h :
392.Bl -tag -width EX_UNAVAILABLE -compact -offset indent
393.It Dv EX_OK
394Successful completion on all addresses.
395.It Dv EX_NOUSER
396User name not recognized.
397.It Dv EX_UNAVAILABLE
398Catchall meaning necessary resources
399were not available.
400.It Dv EX_SYNTAX
401Syntax error in address.
402.It Dv EX_SOFTWARE
403Internal software error,
404including bad arguments.
405.It Dv EX_OSERR
406Temporary operating system error,
407such as
408.Dq cannot fork .
409.It Dv EX_NOHOST
410Host name not recognized.
411.It Dv EX_TEMPFAIL
412Message could not be sent immediately,
413but was queued.
414.El
415.Pp
416If invoked as
417.Nm newaliases ,
418.Nm sendmail
419will rebuild the alias database.
420If invoked as
421.Nm mailq ,
422.Nm sendmail
423will print the contents of the mail queue.
424.Sh FILES
425Except for the file
426.Pa /etc/sendmail.cf
427itself,
428the following pathnames are all specified in
429.Pa /etc/sendmail.cf.
430Thus,
431these values are only approximations.
432.Pp
433.Bl -tag -width /usr/lib/sendmail.fc -compact
434.It Pa /etc/aliases
435raw data for alias names
436.It Pa /etc/aliases.db
437data base of alias names
438.It Pa /etc/sendmail.cf
439configuration file
440.It Pa /etc/sendmail.fc
441frozen configuration
442.It Pa /etc/sendmail.hf
443help file
444.It Pa /var/log/sendmail.st
445collected statistics
446.It Pa /var/spool/mqueue/*
447temp files
448.It Pa /var/run/sendmail.pid
449The process id of the daemon
450.El
451.Sh SEE ALSO
452.Xr binmail 1 ,
453.Xr mail 1 ,
454.Xr rmail 1 ,
455.Xr syslog 3 ,
456.Xr aliases 5 ,
457.Xr mailaddr 7 ,
458.Xr rc 8 ;
459.Pp
460DARPA
461Internet Request For Comments
462.%T RFC819 ,
463.%T RFC821 ,
464.%T RFC822 .
465.Rs
466.%T "Sendmail \- An Internetwork Mail Router"
467.%V SMM
468.%N \&No. 9
469.Re
470.Rs
471.%T "Sendmail Installation and Operation Guide"
472.%V SMM
473.%N \&No. 8
474.Re
475.Sh HISTORY
476The
477.Nm
478command appeared in
479.Bx 4.2 .
480