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