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