163861Sbostic.\" Copyright (c) 1988, 1991, 1993
263861Sbostic.\"	The Regents of the University of California.  All rights reserved.
318857Smckusick.\"
443844Strent.\" %sccs.include.redist.man%
518857Smckusick.\"
6*63862Seric.\"     @(#)sendmail.8	8.2 (Berkeley) 07/18/93
735646Sbostic.\"
847470Scael.Dd
947470Scael.Dt SENDMAIL 8
1047470Scael.Os BSD 4
1147470Scael.Sh NAME
1247470Scael.Nm sendmail
1347470Scael.Nd send mail over the internet
1447470Scael.Sh SYNOPSIS
1547470Scael.Nm sendmail
1647470Scael.Op Ar flags
1747470Scael.Op Ar address ...
1847470Scael.Nm newaliases
1947470Scael.Nm mailq
2047470Scael.Op Fl v
2147470Scael.Sh DESCRIPTION
2247470Scael.Nm Sendmail
2328373Sericsends a message to one or more
2447470Scael.Em recipients ,
2518858Smckusickrouting the message over whatever networks
2618857Smckusickare necessary.
2747470Scael.Nm Sendmail
2818858Smckusickdoes internetwork forwarding as necessary
2918858Smckusickto deliver the message to the correct place.
3047470Scael.Pp
3147470Scael.Nm Sendmail
3218857Smckusickis not intended as a user interface routine;
3318858Smckusickother programs provide user-friendly
3418858Smckusickfront ends;
3547470Scael.Nm sendmail
3618858Smckusickis used only to deliver pre-formatted messages.
3747470Scael.Pp
3818858SmckusickWith no flags,
3947470Scael.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.
4747470Scael.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'.
5763452Seric.Ss Parameters
5847470Scael.Bl -tag -width Fl
5959099Seric.It Fl B Ns Ar type
6059099SericSet the body type to
6159099Seric.Ar type .
6259099SericCurrent legal values
6359099Seric.Li 7BIT
6459099Sericor
6559099Seric.Li 8BITMIME .
6647470Scael.It Fl ba
6747470ScaelGo into
6847470Scael.Tn ARPANET
6947470Scaelmode.
7018858SmckusickAll input lines must end with a CR-LF,
7118858Smckusickand all messages will be generated with a CR-LF at the end.
7218858SmckusickAlso,
7318858Smckusickthe ``From:'' and ``Sender:''
7418858Smckusickfields are examined for the name of the sender.
7547470Scael.It Fl bd
7647470ScaelRun as a daemon.  This requires Berkeley
7747470Scael.Tn IPC .
7847470Scael.Nm Sendmail
7928373Sericwill fork and run in background
8047470Scaellistening on socket 25 for incoming
8147470Scael.Tn SMTP
8247470Scaelconnections.
8328373SericThis is normally run from
8447470Scael.Pa /etc/rc .
8547470Scael.It Fl bi
8618858SmckusickInitialize the alias database.
8747470Scael.It Fl bm
8818858SmckusickDeliver mail in the usual way (default).
8947470Scael.It Fl bp
9018858SmckusickPrint a listing of the queue.
9147470Scael.It Fl bs
9247470ScaelUse the
9347470Scael.Tn SMTP
9447470Scaelprotocol as described in
9547470Scael.Tn RFC821
9628373Sericon standard input and output.
9718858SmckusickThis flag implies all the operations of the
9847470Scael.Fl ba
9947470Scaelflag that are compatible with
10047470Scael.Tn SMTP .
10147470Scael.It Fl bt
10218858SmckusickRun in address test mode.
10318858SmckusickThis mode reads addresses and shows the steps in parsing;
10418858Smckusickit is used for debugging configuration tables.
10547470Scael.It Fl bv
10618858SmckusickVerify names only \- do not try to collect or deliver a message.
10718858SmckusickVerify mode is normally used for validating
10818858Smckusickusers or mailing lists.
10947470Scael.It Fl bz
11018858SmckusickCreate the configuration freeze file.
11147470Scael.It Fl C Ns Ar file
11218858SmckusickUse alternate configuration file.
11347470Scael.Nm Sendmail
11428373Sericrefuses to run as root if an alternate configuration file is specified.
11528373SericThe frozen configuration file is bypassed.
11647470Scael.It Fl d Ns Ar X
11718858SmckusickSet debugging value to
11847470Scael.Ar X .
11947470Scael.It Fl F Ns Ar fullname
12018858SmckusickSet the full name of the sender.
12147470Scael.It Fl f Ns Ar name
12218858SmckusickSets the name of the ``from'' person
12318858Smckusick(i.e., the sender of the mail).
12447470Scael.Fl f
12518858Smckusickcan only be used
12628373Sericby ``trusted'' users
12728373Seric(normally
12847470Scael.Em root ,
12947470Scael.Em daemon ,
13018857Smckusickand
13147470Scael.Em network )
13218857Smckusickor if the person you are trying to become
13318857Smckusickis the same as the person you are.
13447470Scael.It Fl h Ns Ar N
13518858SmckusickSet the hop count to
13647470Scael.Ar N .
13718858SmckusickThe hop count is incremented every time the mail is
13818858Smckusickprocessed.
13918858SmckusickWhen it reaches a limit,
14018858Smckusickthe mail is returned with an error message,
14118858Smckusickthe victim of an aliasing loop.
14228373SericIf not specified,
14328373Seric``Received:'' lines in the message are counted.
14447470Scael.It Fl n
14518858SmckusickDon't do aliasing.
14647470Scael.It Fl o Ns Ar x Em value
14718858SmckusickSet option
14847470Scael.Ar x
14918858Smckusickto the specified
15047470Scael.Em value .
15118858SmckusickOptions are described below.
15257141Seric.It Fl p Ns Ar protocol
15357141SericSet the name of the protocol used to receive the message.
15457141SericThis can be a simple protocol name such as ``UUCP''
15557141Sericor a protocol and hostname, such as ``UUCP:ucbvax''.
15647470Scael.It Fl q Ns Bq Ar time
15718858SmckusickProcessed saved messages in the queue at given intervals.
15818858SmckusickIf
15947470Scael.Ar time
16018858Smckusickis omitted,
16118858Smckusickprocess the queue once.
16247470Scael.Xr Time
16318858Smckusickis given as a tagged number,
16447470Scaelwith
16547470Scael.Ql s
16647470Scaelbeing seconds,
16747470Scael.Ql m
16847470Scaelbeing minutes,
16947470Scael.Ql h
17047470Scaelbeing hours,
17147470Scael.Ql d
17247470Scaelbeing days,
17318858Smckusickand
17447470Scael.Ql w
17547470Scaelbeing weeks.
17618858SmckusickFor example,
17747470Scael.Ql \-q1h30m
17847470Scaelor
17947470Scael.Ql \-q90m
18018858Smckusickwould both set the timeout to one hour thirty minutes.
18128373SericIf
18247470Scael.Ar time
18328373Sericis specified,
18447470Scael.Nm sendmail
18528373Sericwill run in background.
18628373SericThis option can be used safely with
18747470Scael.Fl bd .
18847470Scael.It Fl r Ns Ar name
18918858SmckusickAn alternate and obsolete form of the
19047470Scael.Fl f
19118858Smckusickflag.
19247470Scael.It Fl t
19318858SmckusickRead message for recipients.
19428373SericTo:, Cc:, and Bcc: lines will be scanned for recipient addresses.
19518858SmckusickThe Bcc: line will be deleted before transmission.
19628373SericAny addresses in the argument list will be suppressed,
19728373Sericthat is,
19828373Sericthey will
19947470Scael.Em not
20028373Sericreceive copies even if listed in the message header.
20147470Scael.It Fl v
20218858SmckusickGo into verbose mode.
20318858SmckusickAlias expansions will be announced, etc.
204*63862Seric.It Fl X Ar logfile
205*63862SericLog all traffic in and out of mailers in the indicated log file.
206*63862SericThis should only be used as a last resort
207*63862Sericfor debugging mailer bugs.
208*63862SericIt will log a lot of data very quickly.
20947470Scael.El
21063452Seric.Ss Options
21118858SmckusickThere are also a number of processing options that may be set.
21218858SmckusickNormally these will only be used by a system administrator.
21318858SmckusickOptions may be set either on the command line
21418858Smckusickusing the
21547470Scael.Fl o
21618858Smckusickflag
21718858Smckusickor in the configuration file.
21863451SbosticThis is a partial list;
21963451Sbosticfor a complete list (and details), consult the
22048584Scael.%T "Sendmail Installation and Operation Guide" .
22118858SmckusickThe options are:
22247470Scael.Bl -tag -width Fl
22347470Scael.It Li A Ns Ar file
22418858SmckusickUse alternate alias file.
22563451Sbostic.It Li b Ns Ar nblocks
22663451SbosticThe minimum number of free blocks needed on the spool filesystem.
22747470Scael.It Li c
22818858SmckusickOn mailers that are considered ``expensive'' to connect to,
22918858Smckusickdon't initiate immediate connection.
23018858SmckusickThis requires queueing.
23151305Seric.It Li C Ar N
23251305SericCheckpoint the queue file after every
23351305Seric.Ar N
23451305Sericsuccessful deliveries (default 10).
23551305SericThis avoids excessive duplicate deliveries
23651305Sericwhen sending to long mailing lists
23751305Sericinterrupted by system crashes.
23847470Scael.It Li d Ns Ar x
23918858SmckusickSet the delivery mode to
24047470Scael.Ar x .
24118858SmckusickDelivery modes are
24247470Scael.Ql i
24347470Scaelfor interactive (synchronous) delivery,
24447470Scael.Ql b
24547470Scaelfor background (asynchronous) delivery,
24618858Smckusickand
24747470Scael.Ql q
24847470Scaelfor queue only \- i.e.,
24918858Smckusickactual delivery is done the next time the queue is run.
25047470Scael.It Li D
25118858SmckusickTry to automatically rebuild the alias database
25218858Smckusickif necessary.
25347470Scael.It Li e Ns Ar x
25418858SmckusickSet error processing to mode
25547470Scael.Ar x .
25618858SmckusickValid modes are
25747470Scael.Ql m
25847470Scaelto mail back the error message,
25947470Scael.Ql w
26047470Scaelto ``write'' back the error message
26118858Smckusick(or mail it back if the sender is not logged in),
26247470Scael.Ql p
26347470Scaelto print the errors on the terminal
26418858Smckusick(default),
26547470Scael.Ql q
26647470Scaelto throw away error messages
26718858Smckusick(only exit status is returned),
26847470Scaeland
26947470Scael.Ql e
27018858Smckusickto do special processing for the BerkNet.
27118858SmckusickIf the text of the message is not mailed back
27218858Smckusickby
27347470Scaelmodes
27447470Scael.Ql m
27547470Scaelor
27647470Scael.Ql w
27718858Smckusickand if the sender is local to this machine,
27818858Smckusicka copy of the message is appended to the file
27947470Scael.Pa dead.letter
28018857Smckusickin the sender's home directory.
28147470Scael.It Li f
28247470ScaelSave
28347470Scael.Tn UNIX Ns \-style
28447470ScaelFrom lines at the front of messages.
28563451Sbostic.It Li G
28663451SbosticMatch local mail names against the GECOS portion of the password file.
28747470Scael.It Li g Ar N
28818858SmckusickThe default group id to use when calling mailers.
28947470Scael.It Li H Ns Ar file
29047470ScaelThe
29147470Scael.Tn SMTP
29247470Scaelhelp file.
29351305Seric.It Li h Ar N
29451305SericThe maximum number of times a message is allowed to ``hop''
29551305Sericbefore we decide it is in a loop.
29647470Scael.It Li i
29718858SmckusickDo not take dots on a line by themselves
29818858Smckusickas a message terminator.
29963451Sbostic.It Li j
30063451SbosticSend error messages in MIME format.
30163451Sbostic.It Li K Ns Ar timeout
30263451SbosticSet connection cache timeout.
30363451Sbostic.It Li k Ns Ar N
30463451SbosticSet connection cache size.
30547470Scael.It Li L Ns Ar n
30618858SmckusickThe log level.
30763451Sbostic.It Li l
30863451SbosticPay attention to the Errors-To: header.
30947470Scael.It Li m
31018858SmckusickSend to ``me'' (the sender) also if I am in an alias expansion.
31163451Sbostic.It Li n
31263451SbosticValidate the right hand side of aliases during a
31363451Sbostic.Xr newaliases 1
31463451Sbosticcommand.
31547470Scael.It Li o
31618858SmckusickIf set, this message may have
31718858Smckusickold style headers.
31818858SmckusickIf not set,
31918858Smckusickthis message is guaranteed to have new style headers
32018858Smckusick(i.e., commas instead of spaces between addresses).
32118858SmckusickIf set, an adaptive algorithm is used that will correctly
32218858Smckusickdetermine the header format in most cases.
32347470Scael.It Li Q Ns Ar queuedir
32418858SmckusickSelect the directory in which to queue messages.
32547470Scael.It Li S Ns Ar file
32618858SmckusickSave statistics in the named file.
32747470Scael.It Li s
32818858SmckusickAlways instantiate the queue file,
32918858Smckusickeven under circumstances where it is not strictly necessary.
33028373SericThis provides safety against system crashes during delivery.
33147470Scael.It Li T Ns Ar time
33228373SericSet the timeout on undelivered messages in the queue to the specified time.
33328373SericAfter delivery has failed
33428373Seric(e.g., because of a host being down)
33528373Sericfor this amount of time,
33628373Sericfailed messages will be returned to the sender.
33718858SmckusickThe default is three days.
33847470Scael.It Li t Ns Ar stz , Ar dtz
33918858SmckusickSet the name of the time zone.
34050556Seric.It Li U Ns Ar userdatabase
34150556SericIf set, a user database is consulted to get forwarding information.
34250556SericYou can consider this an adjunct to the aliasing mechanism,
34350556Sericexcept that the database is intended to be distributed;
34450556Sericaliases are local to a particular host.
34550556SericThis may not be available if your sendmail does not have the
34650769Scael.Dv USERDB
34750769Scaeloption compiled in.
34847470Scael.It Li u Ns Ar N
34918858SmckusickSet the default user id for mailers.
35063451Sbostic.It Li Y
35163451SbosticFork each job during queue runs.
35263451SbosticMay be convenient on memory-poor machines.
35363451Sbostic.It Li 7
35463451SbosticStrip incoming messages to seven bits.
35547470Scael.El
35647470Scael.Pp
35728373SericIn aliases,
35828373Sericthe first character of a name may be
35928373Serica vertical bar to cause interpretation of
36028373Sericthe rest of the name as a command
36118857Smckusickto pipe the mail to.
36228373SericIt may be necessary to quote the name
36318857Smckusickto keep
36447470Scael.Nm sendmail
36518857Smckusickfrom suppressing the blanks from between arguments.
36628373SericFor example, a common alias is:
36747470Scael.Pp
36847470Scael.Bd -literal -offset indent -compact
36947470Scaelmsgs: "|/usr/bin/msgs -s"
37047470Scael.Ed
37147470Scael.Pp
37247470ScaelAliases may also have the syntax
37347470Scael.Dq :include: Ns Ar filename
37428373Sericto ask
37547470Scael.Xr sendmail
37628373Sericto read the named file for a list of recipients.
37728373SericFor example, an alias such as:
37847470Scael.Pp
37947470Scael.Bd -literal -offset indent -compact
38047470Scaelpoets: ":include:/usr/local/lib/poets.list"
38147470Scael.Ed
38247470Scael.Pp
38328373Sericwould read
38447470Scael.Pa /usr/local/lib/poets.list
38528373Sericfor the list of addresses making up the group.
38647470Scael.Pp
38747470Scael.Nm Sendmail
38818857Smckusickreturns an exit status
38918857Smckusickdescribing what it did.
39018858SmckusickThe codes are defined in
39147470Scael.Aq Pa sysexits.h :
39247470Scael.Bl -tag -width EX_UNAVAILABLE -compact -offset indent
39347470Scael.It Dv EX_OK
39447470ScaelSuccessful completion on all addresses.
39547470Scael.It Dv EX_NOUSER
39647470ScaelUser name not recognized.
39747470Scael.It Dv EX_UNAVAILABLE
39847470ScaelCatchall meaning necessary resources
39918857Smckusickwere not available.
40047470Scael.It Dv EX_SYNTAX
40147470ScaelSyntax error in address.
40247470Scael.It Dv EX_SOFTWARE
40347470ScaelInternal software error,
40418857Smckusickincluding bad arguments.
40547470Scael.It Dv EX_OSERR
40647470ScaelTemporary operating system error,
40747470Scaelsuch as
40847470Scael.Dq cannot fork .
40947470Scael.It Dv EX_NOHOST
41047470ScaelHost name not recognized.
41147470Scael.It Dv EX_TEMPFAIL
41247470ScaelMessage could not be sent immediately,
41318858Smckusickbut was queued.
41447470Scael.El
41547470Scael.Pp
41618858SmckusickIf invoked as
41747470Scael.Nm newaliases ,
41847470Scael.Nm sendmail
41918858Smckusickwill rebuild the alias database.
42018858SmckusickIf invoked as
42147470Scael.Nm mailq ,
42247470Scael.Nm sendmail
42318858Smckusickwill print the contents of the mail queue.
42447470Scael.Sh FILES
42547470ScaelExcept for the file
42647470Scael.Pa /etc/sendmail.cf
42747470Scaelitself,
42847470Scaelthe following pathnames are all specified in
42947470Scael.Pa /etc/sendmail.cf.
43018858SmckusickThus,
43118858Smckusickthese values are only approximations.
43247470Scael.Pp
43347470Scael.Bl -tag -width /usr/lib/sendmail.fc -compact
43447470Scael.It Pa /etc/aliases
43547470Scaelraw data for alias names
43663451Sbostic.It Pa /etc/aliases.db
43747470Scaeldata base of alias names
43847470Scael.It Pa /etc/sendmail.cf
43947470Scaelconfiguration file
44047470Scael.It Pa /etc/sendmail.fc
44147470Scaelfrozen configuration
44247470Scael.It Pa /etc/sendmail.hf
44347470Scaelhelp file
44447470Scael.It Pa /var/log/sendmail.st
44547470Scaelcollected statistics
44647470Scael.It Pa /var/spool/mqueue/*
44747470Scaeltemp files
44863451Sbostic.It Pa /var/run/sendmail.pid
44963451SbosticThe process id of the daemon
45047470Scael.El
45147470Scael.Sh SEE ALSO
45247470Scael.Xr binmail 1 ,
45347470Scael.Xr mail 1 ,
45447470Scael.Xr rmail 1 ,
45547470Scael.Xr syslog 3 ,
45647470Scael.Xr aliases 5 ,
45747470Scael.Xr mailaddr 7 ,
45847470Scael.Xr rc 8 ;
45947470Scael.Pp
46047470ScaelDARPA
46147470ScaelInternet Request For Comments
46247470Scael.%T RFC819 ,
46347470Scael.%T RFC821 ,
46447470Scael.%T RFC822 .
46547470Scael.Rs
46648584Scael.%T "Sendmail \- An Internetwork Mail Router"
46747470Scael.%V SMM
46847470Scael.%N \&No. 9
46947470Scael.Re
47047470Scael.Rs
47148584Scael.%T "Sendmail Installation and Operation Guide"
47247470Scael.%V SMM
47347470Scael.%N \&No. 8
47447470Scael.Re
47547470Scael.Sh HISTORY
47647470ScaelThe
47747470Scael.Nm
47847470Scaelcommand appeared in
47947470Scael.Bx 4.2 .
480