147470Scael.\" Copyright (c) 1988, 1991 The Regents of the University of California.
235646Sbostic.\" All rights reserved.
318857Smckusick.\"
443844Strent.\" %sccs.include.redist.man%
518857Smckusick.\"
6*57141Seric.\"     @(#)sendmail.8	6.13 (Berkeley) 12/15/92
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'.
5747470Scael.Pp
5818858SmckusickFlags are:
5947470Scael.Bl -tag -width Fl
6047470Scael.It Fl ba
6147470ScaelGo into
6247470Scael.Tn ARPANET
6347470Scaelmode.
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.
6947470Scael.It Fl bd
7047470ScaelRun as a daemon.  This requires Berkeley
7147470Scael.Tn IPC .
7247470Scael.Nm Sendmail
7328373Sericwill fork and run in background
7447470Scaellistening on socket 25 for incoming
7547470Scael.Tn SMTP
7647470Scaelconnections.
7728373SericThis is normally run from
7847470Scael.Pa /etc/rc .
7947470Scael.It Fl bi
8018858SmckusickInitialize the alias database.
8147470Scael.It Fl bm
8218858SmckusickDeliver mail in the usual way (default).
8347470Scael.It Fl bp
8418858SmckusickPrint a listing of the queue.
8547470Scael.It Fl bs
8647470ScaelUse the
8747470Scael.Tn SMTP
8847470Scaelprotocol as described in
8947470Scael.Tn RFC821
9028373Sericon standard input and output.
9118858SmckusickThis flag implies all the operations of the
9247470Scael.Fl ba
9347470Scaelflag that are compatible with
9447470Scael.Tn SMTP .
9547470Scael.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.
9947470Scael.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.
10347470Scael.It Fl bz
10418858SmckusickCreate the configuration freeze file.
10547470Scael.It Fl C Ns Ar file
10618858SmckusickUse alternate configuration file.
10747470Scael.Nm Sendmail
10828373Sericrefuses to run as root if an alternate configuration file is specified.
10928373SericThe frozen configuration file is bypassed.
11047470Scael.It Fl d Ns Ar X
11118858SmckusickSet debugging value to
11247470Scael.Ar X .
11347470Scael.It Fl F Ns Ar fullname
11418858SmckusickSet the full name of the sender.
11547470Scael.It Fl f Ns Ar name
11618858SmckusickSets the name of the ``from'' person
11718858Smckusick(i.e., the sender of the mail).
11847470Scael.Fl f
11918858Smckusickcan only be used
12028373Sericby ``trusted'' users
12128373Seric(normally
12247470Scael.Em root ,
12347470Scael.Em daemon ,
12418857Smckusickand
12547470Scael.Em network )
12618857Smckusickor if the person you are trying to become
12718857Smckusickis the same as the person you are.
12847470Scael.It Fl h Ns Ar N
12918858SmckusickSet the hop count to
13047470Scael.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.
13847470Scael.It Fl n
13918858SmckusickDon't do aliasing.
14047470Scael.It Fl o Ns Ar x Em value
14118858SmckusickSet option
14247470Scael.Ar x
14318858Smckusickto the specified
14447470Scael.Em value .
14518858SmckusickOptions are described below.
146*57141Seric.It Fl p Ns Ar protocol
147*57141SericSet the name of the protocol used to receive the message.
148*57141SericThis can be a simple protocol name such as ``UUCP''
149*57141Sericor a protocol and hostname, such as ``UUCP:ucbvax''.
15047470Scael.It Fl q Ns Bq Ar time
15118858SmckusickProcessed saved messages in the queue at given intervals.
15218858SmckusickIf
15347470Scael.Ar time
15418858Smckusickis omitted,
15518858Smckusickprocess the queue once.
15647470Scael.Xr Time
15718858Smckusickis given as a tagged number,
15847470Scaelwith
15947470Scael.Ql s
16047470Scaelbeing seconds,
16147470Scael.Ql m
16247470Scaelbeing minutes,
16347470Scael.Ql h
16447470Scaelbeing hours,
16547470Scael.Ql d
16647470Scaelbeing days,
16718858Smckusickand
16847470Scael.Ql w
16947470Scaelbeing weeks.
17018858SmckusickFor example,
17147470Scael.Ql \-q1h30m
17247470Scaelor
17347470Scael.Ql \-q90m
17418858Smckusickwould both set the timeout to one hour thirty minutes.
17528373SericIf
17647470Scael.Ar time
17728373Sericis specified,
17847470Scael.Nm sendmail
17928373Sericwill run in background.
18028373SericThis option can be used safely with
18147470Scael.Fl bd .
18247470Scael.It Fl r Ns Ar name
18318858SmckusickAn alternate and obsolete form of the
18447470Scael.Fl f
18518858Smckusickflag.
18647470Scael.It Fl t
18718858SmckusickRead message for recipients.
18828373SericTo:, Cc:, and Bcc: lines will be scanned for recipient addresses.
18918858SmckusickThe Bcc: line will be deleted before transmission.
19028373SericAny addresses in the argument list will be suppressed,
19128373Sericthat is,
19228373Sericthey will
19347470Scael.Em not
19428373Sericreceive copies even if listed in the message header.
19547470Scael.It Fl v
19618858SmckusickGo into verbose mode.
19718858SmckusickAlias expansions will be announced, etc.
19847470Scael.El
19947470Scael.Pp
20018858SmckusickThere are also a number of processing options that may be set.
20118858SmckusickNormally these will only be used by a system administrator.
20218858SmckusickOptions may be set either on the command line
20318858Smckusickusing the
20447470Scael.Fl o
20518858Smckusickflag
20618858Smckusickor in the configuration file.
20718858SmckusickThese are described in detail in the
20848584Scael.%T "Sendmail Installation and Operation Guide" .
20918858SmckusickThe options are:
21047470Scael.Bl -tag -width Fl
21147470Scael.It Li A Ns Ar file
21218858SmckusickUse alternate alias file.
21347470Scael.It Li c
21418858SmckusickOn mailers that are considered ``expensive'' to connect to,
21518858Smckusickdon't initiate immediate connection.
21618858SmckusickThis requires queueing.
21751305Seric.It Li C Ar N
21851305SericCheckpoint the queue file after every
21951305Seric.Ar N
22051305Sericsuccessful deliveries (default 10).
22151305SericThis avoids excessive duplicate deliveries
22251305Sericwhen sending to long mailing lists
22351305Sericinterrupted by system crashes.
22447470Scael.It Li d Ns Ar x
22518858SmckusickSet the delivery mode to
22647470Scael.Ar x .
22718858SmckusickDelivery modes are
22847470Scael.Ql i
22947470Scaelfor interactive (synchronous) delivery,
23047470Scael.Ql b
23147470Scaelfor background (asynchronous) delivery,
23218858Smckusickand
23347470Scael.Ql q
23447470Scaelfor queue only \- i.e.,
23518858Smckusickactual delivery is done the next time the queue is run.
23647470Scael.It Li D
23718858SmckusickTry to automatically rebuild the alias database
23818858Smckusickif necessary.
23947470Scael.It Li e Ns Ar x
24018858SmckusickSet error processing to mode
24147470Scael.Ar x .
24218858SmckusickValid modes are
24347470Scael.Ql m
24447470Scaelto mail back the error message,
24547470Scael.Ql w
24647470Scaelto ``write'' back the error message
24718858Smckusick(or mail it back if the sender is not logged in),
24847470Scael.Ql p
24947470Scaelto print the errors on the terminal
25018858Smckusick(default),
25147470Scael.Ql q
25247470Scaelto throw away error messages
25318858Smckusick(only exit status is returned),
25447470Scaeland
25547470Scael.Ql e
25618858Smckusickto do special processing for the BerkNet.
25718858SmckusickIf the text of the message is not mailed back
25818858Smckusickby
25947470Scaelmodes
26047470Scael.Ql m
26147470Scaelor
26247470Scael.Ql w
26318858Smckusickand if the sender is local to this machine,
26418858Smckusicka copy of the message is appended to the file
26547470Scael.Pa dead.letter
26618857Smckusickin the sender's home directory.
26747470Scael.It Li F Ns Ar mode
26818858SmckusickThe mode to use when creating temporary files.
26947470Scael.It Li f
27047470ScaelSave
27147470Scael.Tn UNIX Ns \-style
27247470ScaelFrom lines at the front of messages.
27347470Scael.It Li g Ar N
27418858SmckusickThe default group id to use when calling mailers.
27547470Scael.It Li H Ns Ar file
27647470ScaelThe
27747470Scael.Tn SMTP
27847470Scaelhelp file.
27951305Seric.It Li h Ar N
28051305SericThe maximum number of times a message is allowed to ``hop''
28151305Sericbefore we decide it is in a loop.
28247470Scael.It Li i
28318858SmckusickDo not take dots on a line by themselves
28418858Smckusickas a message terminator.
28547470Scael.It Li L Ns Ar n
28618858SmckusickThe log level.
28747470Scael.It Li m
28818858SmckusickSend to ``me'' (the sender) also if I am in an alias expansion.
28947470Scael.It Li o
29018858SmckusickIf set, this message may have
29118858Smckusickold style headers.
29218858SmckusickIf not set,
29318858Smckusickthis message is guaranteed to have new style headers
29418858Smckusick(i.e., commas instead of spaces between addresses).
29518858SmckusickIf set, an adaptive algorithm is used that will correctly
29618858Smckusickdetermine the header format in most cases.
29747470Scael.It Li Q Ns Ar queuedir
29818858SmckusickSelect the directory in which to queue messages.
29947470Scael.It Li r Ns Ar timeout
30018858SmckusickThe timeout on reads;
30118858Smckusickif none is set,
30247470Scael.Nm sendmail
30318858Smckusickwill wait forever for a mailer.
30447470ScaelThis option violates the word (if not the intent) of the
30547470Scael.Tn SMTP
30647470Scaelspecification,
30728373Sericshow the timeout should probably be fairly large.
30847470Scael.It Li S Ns Ar file
30918858SmckusickSave statistics in the named file.
31047470Scael.It Li s
31118858SmckusickAlways instantiate the queue file,
31218858Smckusickeven under circumstances where it is not strictly necessary.
31328373SericThis provides safety against system crashes during delivery.
31447470Scael.It Li T Ns Ar time
31528373SericSet the timeout on undelivered messages in the queue to the specified time.
31628373SericAfter delivery has failed
31728373Seric(e.g., because of a host being down)
31828373Sericfor this amount of time,
31928373Sericfailed messages will be returned to the sender.
32018858SmckusickThe default is three days.
32147470Scael.It Li t Ns Ar stz , Ar dtz
32218858SmckusickSet the name of the time zone.
32350556Seric.It Li U Ns Ar userdatabase
32450556SericIf set, a user database is consulted to get forwarding information.
32550556SericYou can consider this an adjunct to the aliasing mechanism,
32650556Sericexcept that the database is intended to be distributed;
32750556Sericaliases are local to a particular host.
32850556SericThis may not be available if your sendmail does not have the
32950769Scael.Dv USERDB
33050769Scaeloption compiled in.
33147470Scael.It Li u Ns Ar N
33218858SmckusickSet the default user id for mailers.
33350537Seric.It Li w
33451216SericIf set, name server lookups will us a querytype of ANY
33550537Sericto find types
33650769Scael.Dv CNAME , A ,
33750769Scaeland
33850769Scael.Dv MX ,
33950537Sericand will cause all existing records to be cached by our local server.
34051216SericIf you are certain that there are no wildcard MX records in the local domain
34151216Sericor its parents that are searched, you can
34251216Sericset this option.
34351216SericIf the option is not set,
34451216Sericname server lookups will use a querytype of
34550769Scael.Dv CNAME
34650769Scaelonly;
34750537Sericotherwise, it would cause all fully-qualified names
34850537Sericto match as names in the local domain.
34947470Scael.El
35047470Scael.Pp
35128373SericIn aliases,
35228373Sericthe first character of a name may be
35328373Serica vertical bar to cause interpretation of
35428373Sericthe rest of the name as a command
35518857Smckusickto pipe the mail to.
35628373SericIt may be necessary to quote the name
35718857Smckusickto keep
35847470Scael.Nm sendmail
35918857Smckusickfrom suppressing the blanks from between arguments.
36028373SericFor example, a common alias is:
36147470Scael.Pp
36247470Scael.Bd -literal -offset indent -compact
36347470Scaelmsgs: "|/usr/bin/msgs -s"
36447470Scael.Ed
36547470Scael.Pp
36647470ScaelAliases may also have the syntax
36747470Scael.Dq :include: Ns Ar filename
36828373Sericto ask
36947470Scael.Xr sendmail
37028373Sericto read the named file for a list of recipients.
37128373SericFor example, an alias such as:
37247470Scael.Pp
37347470Scael.Bd -literal -offset indent -compact
37447470Scaelpoets: ":include:/usr/local/lib/poets.list"
37547470Scael.Ed
37647470Scael.Pp
37728373Sericwould read
37847470Scael.Pa /usr/local/lib/poets.list
37928373Sericfor the list of addresses making up the group.
38047470Scael.Pp
38147470Scael.Nm Sendmail
38218857Smckusickreturns an exit status
38318857Smckusickdescribing what it did.
38418858SmckusickThe codes are defined in
38547470Scael.Aq Pa sysexits.h :
38647470Scael.Bl -tag -width EX_UNAVAILABLE -compact -offset indent
38747470Scael.It Dv EX_OK
38847470ScaelSuccessful completion on all addresses.
38947470Scael.It Dv EX_NOUSER
39047470ScaelUser name not recognized.
39147470Scael.It Dv EX_UNAVAILABLE
39247470ScaelCatchall meaning necessary resources
39318857Smckusickwere not available.
39447470Scael.It Dv EX_SYNTAX
39547470ScaelSyntax error in address.
39647470Scael.It Dv EX_SOFTWARE
39747470ScaelInternal software error,
39818857Smckusickincluding bad arguments.
39947470Scael.It Dv EX_OSERR
40047470ScaelTemporary operating system error,
40147470Scaelsuch as
40247470Scael.Dq cannot fork .
40347470Scael.It Dv EX_NOHOST
40447470ScaelHost name not recognized.
40547470Scael.It Dv EX_TEMPFAIL
40647470ScaelMessage could not be sent immediately,
40718858Smckusickbut was queued.
40847470Scael.El
40947470Scael.Pp
41018858SmckusickIf invoked as
41147470Scael.Nm newaliases ,
41247470Scael.Nm sendmail
41318858Smckusickwill rebuild the alias database.
41418858SmckusickIf invoked as
41547470Scael.Nm mailq ,
41647470Scael.Nm sendmail
41718858Smckusickwill print the contents of the mail queue.
41847470Scael.Sh FILES
41947470ScaelExcept for the file
42047470Scael.Pa /etc/sendmail.cf
42147470Scaelitself,
42247470Scaelthe following pathnames are all specified in
42347470Scael.Pa /etc/sendmail.cf.
42418858SmckusickThus,
42518858Smckusickthese values are only approximations.
42647470Scael.Pp
42747470Scael.Bl -tag -width /usr/lib/sendmail.fc -compact
42847470Scael.It Pa /etc/aliases
42947470Scaelraw data for alias names
43047470Scael.It Pa /etc/aliases.pag
43147470Scael.It Pa /etc/aliases.dir
43247470Scaeldata base of alias names
43347470Scael.It Pa /etc/sendmail.cf
43447470Scaelconfiguration file
43547470Scael.It Pa /etc/sendmail.fc
43647470Scaelfrozen configuration
43747470Scael.It Pa /etc/sendmail.hf
43847470Scaelhelp file
43947470Scael.It Pa /var/log/sendmail.st
44047470Scaelcollected statistics
44147470Scael.It Pa /var/spool/mqueue/*
44247470Scaeltemp files
44347470Scael.El
44447470Scael.Sh SEE ALSO
44547470Scael.Xr binmail 1 ,
44647470Scael.Xr mail 1 ,
44747470Scael.Xr rmail 1 ,
44847470Scael.Xr syslog 3 ,
44947470Scael.Xr aliases 5 ,
45047470Scael.Xr mailaddr 7 ,
45147470Scael.Xr rc 8 ;
45247470Scael.Pp
45347470ScaelDARPA
45447470ScaelInternet Request For Comments
45547470Scael.%T RFC819 ,
45647470Scael.%T RFC821 ,
45747470Scael.%T RFC822 .
45847470Scael.Rs
45948584Scael.%T "Sendmail \- An Internetwork Mail Router"
46047470Scael.%V SMM
46147470Scael.%N \&No. 9
46247470Scael.Re
46347470Scael.Rs
46448584Scael.%T "Sendmail Installation and Operation Guide"
46547470Scael.%V SMM
46647470Scael.%N \&No. 8
46747470Scael.Re
46847470Scael.Sh HISTORY
46947470ScaelThe
47047470Scael.Nm
47147470Scaelcommand appeared in
47247470Scael.Bx 4.2 .
473