1*47470Scael.\" Copyright (c) 1988, 1991 The Regents of the University of California.
235646Sbostic.\" All rights reserved.
318857Smckusick.\"
443844Strent.\" %sccs.include.redist.man%
518857Smckusick.\"
6*47470Scael.\"     @(#)sendmail.8	6.5 (Berkeley) 03/16/91
735646Sbostic.\"
8*47470Scael.Dd
9*47470Scael.Dt SENDMAIL 8
10*47470Scael.Os BSD 4
11*47470Scael.Sh NAME
12*47470Scael.Nm sendmail
13*47470Scael.Nd send mail over the internet
14*47470Scael.Sh SYNOPSIS
15*47470Scael.Nm sendmail
16*47470Scael.Op Ar flags
17*47470Scael.Op Ar address ...
18*47470Scael.Nm newaliases
19*47470Scael.Nm mailq
20*47470Scael.Op Fl v
21*47470Scael.Sh DESCRIPTION
22*47470Scael.Nm Sendmail
2328373Sericsends a message to one or more
24*47470Scael.Em recipients ,
2518858Smckusickrouting the message over whatever networks
2618857Smckusickare necessary.
27*47470Scael.Nm Sendmail
2818858Smckusickdoes internetwork forwarding as necessary
2918858Smckusickto deliver the message to the correct place.
30*47470Scael.Pp
31*47470Scael.Nm Sendmail
3218857Smckusickis not intended as a user interface routine;
3318858Smckusickother programs provide user-friendly
3418858Smckusickfront ends;
35*47470Scael.Nm sendmail
3618858Smckusickis used only to deliver pre-formatted messages.
37*47470Scael.Pp
3818858SmckusickWith no flags,
39*47470Scael.Nm sendmail
4018857Smckusickreads its standard input
4128373Sericup to an end-of-file
4228373Sericor a line consisting only of a single dot
4328373Sericand sends a copy of the message found there
4418857Smckusickto all of the addresses listed.
4528373SericIt determines the network(s) to use
4618858Smckusickbased on the syntax and contents of the addresses.
47*47470Scael.Pp
4818857SmckusickLocal addresses are looked up in a file
4918857Smckusickand aliased appropriately.
5018857SmckusickAliasing can be prevented by preceding the address
5118858Smckusickwith a backslash.
5218857SmckusickNormally the sender is not included in any alias
5318857Smckusickexpansions, e.g.,
5418857Smckusickif `john' sends to `group',
5518857Smckusickand `group' includes `john' in the expansion,
5618857Smckusickthen the letter will not be delivered to `john'.
57*47470Scael.Pp
5818858SmckusickFlags are:
59*47470Scael.Bl -tag -width Fl
60*47470Scael.It Fl ba
61*47470ScaelGo into
62*47470Scael.Tn ARPANET
63*47470Scaelmode.
6418858SmckusickAll input lines must end with a CR-LF,
6518858Smckusickand all messages will be generated with a CR-LF at the end.
6618858SmckusickAlso,
6718858Smckusickthe ``From:'' and ``Sender:''
6818858Smckusickfields are examined for the name of the sender.
69*47470Scael.It Fl bd
70*47470ScaelRun as a daemon.  This requires Berkeley
71*47470Scael.Tn IPC .
72*47470Scael.Nm Sendmail
7328373Sericwill fork and run in background
74*47470Scaellistening on socket 25 for incoming
75*47470Scael.Tn SMTP
76*47470Scaelconnections.
7728373SericThis is normally run from
78*47470Scael.Pa /etc/rc .
79*47470Scael.It Fl bi
8018858SmckusickInitialize the alias database.
81*47470Scael.It Fl bm
8218858SmckusickDeliver mail in the usual way (default).
83*47470Scael.It Fl bp
8418858SmckusickPrint a listing of the queue.
85*47470Scael.It Fl bs
86*47470ScaelUse the
87*47470Scael.Tn SMTP
88*47470Scaelprotocol as described in
89*47470Scael.Tn RFC821
9028373Sericon standard input and output.
9118858SmckusickThis flag implies all the operations of the
92*47470Scael.Fl ba
93*47470Scaelflag that are compatible with
94*47470Scael.Tn SMTP .
95*47470Scael.It Fl bt
9618858SmckusickRun in address test mode.
9718858SmckusickThis mode reads addresses and shows the steps in parsing;
9818858Smckusickit is used for debugging configuration tables.
99*47470Scael.It Fl bv
10018858SmckusickVerify names only \- do not try to collect or deliver a message.
10118858SmckusickVerify mode is normally used for validating
10218858Smckusickusers or mailing lists.
103*47470Scael.It Fl bz
10418858SmckusickCreate the configuration freeze file.
105*47470Scael.It Fl C Ns Ar file
10618858SmckusickUse alternate configuration file.
107*47470Scael.Nm Sendmail
10828373Sericrefuses to run as root if an alternate configuration file is specified.
10928373SericThe frozen configuration file is bypassed.
110*47470Scael.It Fl d Ns Ar X
11118858SmckusickSet debugging value to
112*47470Scael.Ar X .
113*47470Scael.It Fl F Ns Ar fullname
11418858SmckusickSet the full name of the sender.
115*47470Scael.It Fl f Ns Ar name
11618858SmckusickSets the name of the ``from'' person
11718858Smckusick(i.e., the sender of the mail).
118*47470Scael.Fl f
11918858Smckusickcan only be used
12028373Sericby ``trusted'' users
12128373Seric(normally
122*47470Scael.Em root ,
123*47470Scael.Em daemon ,
12418857Smckusickand
125*47470Scael.Em network )
12618857Smckusickor if the person you are trying to become
12718857Smckusickis the same as the person you are.
128*47470Scael.It Fl h Ns Ar N
12918858SmckusickSet the hop count to
130*47470Scael.Ar N .
13118858SmckusickThe hop count is incremented every time the mail is
13218858Smckusickprocessed.
13318858SmckusickWhen it reaches a limit,
13418858Smckusickthe mail is returned with an error message,
13518858Smckusickthe victim of an aliasing loop.
13628373SericIf not specified,
13728373Seric``Received:'' lines in the message are counted.
138*47470Scael.It Fl n
13918858SmckusickDon't do aliasing.
140*47470Scael.It Fl o Ns Ar x Em value
14118858SmckusickSet option
142*47470Scael.Ar x
14318858Smckusickto the specified
144*47470Scael.Em value .
14518858SmckusickOptions are described below.
146*47470Scael.It Fl q Ns Bq Ar time
14718858SmckusickProcessed saved messages in the queue at given intervals.
14818858SmckusickIf
149*47470Scael.Ar time
15018858Smckusickis omitted,
15118858Smckusickprocess the queue once.
152*47470Scael.Xr Time
15318858Smckusickis given as a tagged number,
154*47470Scaelwith
155*47470Scael.Ql s
156*47470Scaelbeing seconds,
157*47470Scael.Ql m
158*47470Scaelbeing minutes,
159*47470Scael.Ql h
160*47470Scaelbeing hours,
161*47470Scael.Ql d
162*47470Scaelbeing days,
16318858Smckusickand
164*47470Scael.Ql w
165*47470Scaelbeing weeks.
16618858SmckusickFor example,
167*47470Scael.Ql \-q1h30m
168*47470Scaelor
169*47470Scael.Ql \-q90m
17018858Smckusickwould both set the timeout to one hour thirty minutes.
17128373SericIf
172*47470Scael.Ar time
17328373Sericis specified,
174*47470Scael.Nm sendmail
17528373Sericwill run in background.
17628373SericThis option can be used safely with
177*47470Scael.Fl bd .
178*47470Scael.It Fl r Ns Ar name
17918858SmckusickAn alternate and obsolete form of the
180*47470Scael.Fl f
18118858Smckusickflag.
182*47470Scael.It Fl t
18318858SmckusickRead message for recipients.
18428373SericTo:, Cc:, and Bcc: lines will be scanned for recipient addresses.
18518858SmckusickThe Bcc: line will be deleted before transmission.
18628373SericAny addresses in the argument list will be suppressed,
18728373Sericthat is,
18828373Sericthey will
189*47470Scael.Em not
19028373Sericreceive copies even if listed in the message header.
191*47470Scael.It Fl v
19218858SmckusickGo into verbose mode.
19318858SmckusickAlias expansions will be announced, etc.
194*47470Scael.El
195*47470Scael.Pp
19618858SmckusickThere are also a number of processing options that may be set.
19718858SmckusickNormally these will only be used by a system administrator.
19818858SmckusickOptions may be set either on the command line
19918858Smckusickusing the
200*47470Scael.Fl o
20118858Smckusickflag
20218858Smckusickor in the configuration file.
20318858SmckusickThese are described in detail in the
204*47470Scael.%T Sendmail Installation and Operation Guide.
20518858SmckusickThe options are:
206*47470Scael.Bl -tag -width Fl
207*47470Scael.It Li A Ns Ar file
20818858SmckusickUse alternate alias file.
209*47470Scael.It Li c
21018858SmckusickOn mailers that are considered ``expensive'' to connect to,
21118858Smckusickdon't initiate immediate connection.
21218858SmckusickThis requires queueing.
213*47470Scael.It Li d Ns Ar x
21418858SmckusickSet the delivery mode to
215*47470Scael.Ar x .
21618858SmckusickDelivery modes are
217*47470Scael.Ql i
218*47470Scaelfor interactive (synchronous) delivery,
219*47470Scael.Ql b
220*47470Scaelfor background (asynchronous) delivery,
22118858Smckusickand
222*47470Scael.Ql q
223*47470Scaelfor queue only \- i.e.,
22418858Smckusickactual delivery is done the next time the queue is run.
225*47470Scael.It Li D
22618858SmckusickTry to automatically rebuild the alias database
22718858Smckusickif necessary.
228*47470Scael.It Li e Ns Ar x
22918858SmckusickSet error processing to mode
230*47470Scael.Ar x .
23118858SmckusickValid modes are
232*47470Scael.Ql m
233*47470Scaelto mail back the error message,
234*47470Scael.Ql w
235*47470Scaelto ``write'' back the error message
23618858Smckusick(or mail it back if the sender is not logged in),
237*47470Scael.Ql p
238*47470Scaelto print the errors on the terminal
23918858Smckusick(default),
240*47470Scael.Ql q
241*47470Scaelto throw away error messages
24218858Smckusick(only exit status is returned),
243*47470Scaeland
244*47470Scael.Ql e
24518858Smckusickto do special processing for the BerkNet.
24618858SmckusickIf the text of the message is not mailed back
24718858Smckusickby
248*47470Scaelmodes
249*47470Scael.Ql m
250*47470Scaelor
251*47470Scael.Ql w
25218858Smckusickand if the sender is local to this machine,
25318858Smckusicka copy of the message is appended to the file
254*47470Scael.Pa dead.letter
25518857Smckusickin the sender's home directory.
256*47470Scael.It Li F Ns Ar mode
25718858SmckusickThe mode to use when creating temporary files.
258*47470Scael.It Li f
259*47470ScaelSave
260*47470Scael.Tn UNIX Ns \-style
261*47470ScaelFrom lines at the front of messages.
262*47470Scael.It Li g Ar N
26318858SmckusickThe default group id to use when calling mailers.
264*47470Scael.It Li H Ns Ar file
265*47470ScaelThe
266*47470Scael.Tn SMTP
267*47470Scaelhelp file.
268*47470Scael.It Li i
26918858SmckusickDo not take dots on a line by themselves
27018858Smckusickas a message terminator.
271*47470Scael.It Li L Ns Ar n
27218858SmckusickThe log level.
273*47470Scael.It Li m
27418858SmckusickSend to ``me'' (the sender) also if I am in an alias expansion.
275*47470Scael.It Li o
27618858SmckusickIf set, this message may have
27718858Smckusickold style headers.
27818858SmckusickIf not set,
27918858Smckusickthis message is guaranteed to have new style headers
28018858Smckusick(i.e., commas instead of spaces between addresses).
28118858SmckusickIf set, an adaptive algorithm is used that will correctly
28218858Smckusickdetermine the header format in most cases.
283*47470Scael.It Li Q Ns Ar queuedir
28418858SmckusickSelect the directory in which to queue messages.
285*47470Scael.It Li r Ns Ar timeout
28618858SmckusickThe timeout on reads;
28718858Smckusickif none is set,
288*47470Scael.Nm sendmail
28918858Smckusickwill wait forever for a mailer.
290*47470ScaelThis option violates the word (if not the intent) of the
291*47470Scael.Tn SMTP
292*47470Scaelspecification,
29328373Sericshow the timeout should probably be fairly large.
294*47470Scael.It Li S Ns Ar file
29518858SmckusickSave statistics in the named file.
296*47470Scael.It Li s
29718858SmckusickAlways instantiate the queue file,
29818858Smckusickeven under circumstances where it is not strictly necessary.
29928373SericThis provides safety against system crashes during delivery.
300*47470Scael.It Li T Ns Ar time
30128373SericSet the timeout on undelivered messages in the queue to the specified time.
30228373SericAfter delivery has failed
30328373Seric(e.g., because of a host being down)
30428373Sericfor this amount of time,
30528373Sericfailed messages will be returned to the sender.
30618858SmckusickThe default is three days.
307*47470Scael.It Li t Ns Ar stz , Ar dtz
30818858SmckusickSet the name of the time zone.
309*47470Scael.It Li u Ns Ar N
31018858SmckusickSet the default user id for mailers.
311*47470Scael.El
312*47470Scael.Pp
31328373SericIn aliases,
31428373Sericthe first character of a name may be
31528373Serica vertical bar to cause interpretation of
31628373Sericthe rest of the name as a command
31718857Smckusickto pipe the mail to.
31828373SericIt may be necessary to quote the name
31918857Smckusickto keep
320*47470Scael.Nm sendmail
32118857Smckusickfrom suppressing the blanks from between arguments.
32228373SericFor example, a common alias is:
323*47470Scael.Pp
324*47470Scael.Bd -literal -offset indent -compact
325*47470Scaelmsgs: "|/usr/bin/msgs -s"
326*47470Scael.Ed
327*47470Scael.Pp
328*47470ScaelAliases may also have the syntax
329*47470Scael.Dq :include: Ns Ar filename
33028373Sericto ask
331*47470Scael.Xr sendmail
33228373Sericto read the named file for a list of recipients.
33328373SericFor example, an alias such as:
334*47470Scael.Pp
335*47470Scael.Bd -literal -offset indent -compact
336*47470Scaelpoets: ":include:/usr/local/lib/poets.list"
337*47470Scael.Ed
338*47470Scael.Pp
33928373Sericwould read
340*47470Scael.Pa /usr/local/lib/poets.list
34128373Sericfor the list of addresses making up the group.
342*47470Scael.Pp
343*47470Scael.Nm Sendmail
34418857Smckusickreturns an exit status
34518857Smckusickdescribing what it did.
34618858SmckusickThe codes are defined in
347*47470Scael.Aq Pa sysexits.h :
348*47470Scael.Bl -tag -width EX_UNAVAILABLE -compact -offset indent
349*47470Scael.It Dv EX_OK
350*47470ScaelSuccessful completion on all addresses.
351*47470Scael.It Dv EX_NOUSER
352*47470ScaelUser name not recognized.
353*47470Scael.It Dv EX_UNAVAILABLE
354*47470ScaelCatchall meaning necessary resources
35518857Smckusickwere not available.
356*47470Scael.It Dv EX_SYNTAX
357*47470ScaelSyntax error in address.
358*47470Scael.It Dv EX_SOFTWARE
359*47470ScaelInternal software error,
36018857Smckusickincluding bad arguments.
361*47470Scael.It Dv EX_OSERR
362*47470ScaelTemporary operating system error,
363*47470Scaelsuch as
364*47470Scael.Dq cannot fork .
365*47470Scael.It Dv EX_NOHOST
366*47470ScaelHost name not recognized.
367*47470Scael.It Dv EX_TEMPFAIL
368*47470ScaelMessage could not be sent immediately,
36918858Smckusickbut was queued.
370*47470Scael.El
371*47470Scael.Pp
37218858SmckusickIf invoked as
373*47470Scael.Nm newaliases ,
374*47470Scael.Nm sendmail
37518858Smckusickwill rebuild the alias database.
37618858SmckusickIf invoked as
377*47470Scael.Nm mailq ,
378*47470Scael.Nm sendmail
37918858Smckusickwill print the contents of the mail queue.
380*47470Scael.Sh FILES
381*47470ScaelExcept for the file
382*47470Scael.Pa /etc/sendmail.cf
383*47470Scaelitself,
384*47470Scaelthe following pathnames are all specified in
385*47470Scael.Pa /etc/sendmail.cf.
38618858SmckusickThus,
38718858Smckusickthese values are only approximations.
388*47470Scael.Pp
389*47470Scael.Bl -tag -width /usr/lib/sendmail.fc -compact
390*47470Scael.It Pa /etc/aliases
391*47470Scaelraw data for alias names
392*47470Scael.It Pa /etc/aliases.pag
393*47470Scael.It Pa /etc/aliases.dir
394*47470Scaeldata base of alias names
395*47470Scael.It Pa /etc/sendmail.cf
396*47470Scaelconfiguration file
397*47470Scael.It Pa /etc/sendmail.fc
398*47470Scaelfrozen configuration
399*47470Scael.It Pa /etc/sendmail.hf
400*47470Scaelhelp file
401*47470Scael.It Pa /var/log/sendmail.st
402*47470Scaelcollected statistics
403*47470Scael.It Pa /var/spool/mqueue/*
404*47470Scaeltemp files
405*47470Scael.El
406*47470Scael.Sh SEE ALSO
407*47470Scael.Xr binmail 1 ,
408*47470Scael.Xr mail 1 ,
409*47470Scael.Xr rmail 1 ,
410*47470Scael.Xr syslog 3 ,
411*47470Scael.Xr aliases 5 ,
412*47470Scael.Xr mailaddr 7 ,
413*47470Scael.Xr rc 8 ;
414*47470Scael.Pp
415*47470ScaelDARPA
416*47470ScaelInternet Request For Comments
417*47470Scael.%T RFC819 ,
418*47470Scael.%T RFC821 ,
419*47470Scael.%T RFC822 .
420*47470Scael.Rs
421*47470Scael.%T Sendmail \- An Internetwork Mail Router
422*47470Scael.%V SMM
423*47470Scael.%N \&No. 9
424*47470Scael.Re
425*47470Scael.Rs
426*47470Scael.%T Sendmail Installation and Operation Guide
427*47470Scael.%V SMM
428*47470Scael.%N \&No. 8
429*47470Scael.Re
430*47470Scael.Sh HISTORY
431*47470ScaelThe
432*47470Scael.Nm
433*47470Scaelcommand appeared in
434*47470Scael.Bx 4.2 .
435