xref: /freebsd/contrib/sendmail/src/sendmail.8 (revision 11afcc8f9f96d657b8e6f7547c02c1957331fc96)
1.\" Copyright (c) 1998 Sendmail, Inc.  All rights reserved.
2.\" Copyright (c) 1983, 1997 Eric P. Allman.  All rights reserved.
3.\" Copyright (c) 1988, 1991, 1993
4.\"	The Regents of the University of California.  All rights reserved.
5.\"
6.\" By using this file, you agree to the terms and conditions set
7.\" forth in the LICENSE file which can be found at the top level of
8.\" the sendmail distribution.
9.\"
10.\"
11.\"     @(#)sendmail.8	8.19 (Berkeley) 5/19/98
12.\"
13.Dd May 19, 1998
14.Dt SENDMAIL 8
15.Os BSD 4
16.Sh NAME
17.Nm sendmail
18.Nd an electronic mail transport agent
19.Sh SYNOPSIS
20.Nm sendmail
21.Op Ar flags
22.Op Ar address ...
23.Nm newaliases
24.Nm mailq
25.Op Fl v
26.Sh DESCRIPTION
27.Nm Sendmail
28sends a message to one or more
29.Em recipients ,
30routing the message over whatever networks
31are necessary.
32.Nm Sendmail
33does internetwork forwarding as necessary
34to deliver the message to the correct place.
35.Pp
36.Nm Sendmail
37is not intended as a user interface routine;
38other programs provide user-friendly
39front ends;
40.Nm sendmail
41is used only to deliver pre-formatted messages.
42.Pp
43With no flags,
44.Nm sendmail
45reads its standard input
46up to an end-of-file
47or a line consisting only of a single dot
48and sends a copy of the message found there
49to all of the addresses listed.
50It determines the network(s) to use
51based on the syntax and contents of the addresses.
52.Pp
53Local addresses are looked up in a file
54and aliased appropriately.
55Aliasing can be prevented by preceding the address
56with a backslash.
57Normally the sender is not included in any alias
58expansions, e.g.,
59if `john' sends to `group',
60and `group' includes `john' in the expansion,
61then the letter will not be delivered to `john'.
62.Ss Parameters
63.Bl -tag -width Fl
64.It Fl B Ns Ar type
65Set the body type to
66.Ar type .
67Current legal values
68.Li 7BIT
69or
70.Li 8BITMIME .
71.It Fl ba
72Go into
73.Tn ARPANET
74mode.
75All input lines must end with a CR-LF,
76and all messages will be generated with a CR-LF at the end.
77Also,
78the ``From:'' and ``Sender:''
79fields are examined for the name of the sender.
80.It Fl bd
81Run as a daemon.  This requires Berkeley
82.Tn IPC .
83.Nm Sendmail
84will fork and run in background
85listening on socket 25 for incoming
86.Tn SMTP
87connections.
88This is normally run from
89.Pa /etc/rc .
90.It Fl bD
91Same as
92.Fl bd
93except runs in foreground.
94.It Fl bh
95Print the persistent host status database.
96.It Fl bH
97Purge the persistent host status database.
98.It Fl bi
99Initialize the alias database.
100.It Fl bm
101Deliver mail in the usual way (default).
102.It Fl bp
103Print a listing of the queue.
104.It Fl bs
105Use the
106.Tn SMTP
107protocol as described in
108.Tn RFC821
109on standard input and output.
110This flag implies all the operations of the
111.Fl ba
112flag that are compatible with
113.Tn SMTP .
114.It Fl bt
115Run in address test mode.
116This mode reads addresses and shows the steps in parsing;
117it is used for debugging configuration tables.
118.It Fl bv
119Verify names only \- do not try to collect or deliver a message.
120Verify mode is normally used for validating
121users or mailing lists.
122.It Fl C Ns Ar file
123Use alternate configuration file.
124.Nm Sendmail
125refuses to run as root if an alternate configuration file is specified.
126.It Fl d Ns Ar X
127Set debugging value to
128.Ar X .
129.ne 1i
130.It Fl F Ns Ar fullname
131Set the full name of the sender.
132.It Fl f Ns Ar name
133Sets the name of the ``from'' person
134(i.e., the sender of the mail).
135.Fl f
136can only be used
137by ``trusted'' users
138(normally
139.Em root ,
140.Em daemon ,
141and
142.Em network )
143or if the person you are trying to become
144is the same as the person you are.
145.It Fl h Ns Ar N
146Set the hop count to
147.Ar N .
148The hop count is incremented every time the mail is
149processed.
150When it reaches a limit,
151the mail is returned with an error message,
152the victim of an aliasing loop.
153If not specified,
154``Received:'' lines in the message are counted.
155.It Fl i
156Ignore dots alone on lines by themselves in incoming messages.
157This should be set if you are reading data from a file.
158.It Fl N Ar dsn
159Set delivery status notification conditions to
160.Ar dsn,
161which can be
162.Ql never
163for no notifications
164or a comma separated list of the values
165.Ql failure
166to be notified if delivery failed,
167.Ql delay
168to be notified if delivery is delayed, and
169.Ql success
170to be notified when the message is successfully delivered.
171.It Fl n
172Don't do aliasing.
173.It Fl O Ar option Ns = Ns Em value
174Set option
175.Ar option
176to the specified
177.Em value .
178This form uses long names.
179See below for more details.
180.It Fl o Ns Ar x Em value
181Set option
182.Ar x
183to the specified
184.Em value .
185This form uses single character names only.
186The short names are not described in this manual page;
187see the
188.%T "Sendmail Installation and Operation Guide"
189for details.
190.It Fl p Ns Ar protocol
191Set the name of the protocol used to receive the message.
192This can be a simple protocol name such as ``UUCP''
193or a protocol and hostname, such as ``UUCP:ucbvax''.
194.It Fl q Ns Bq Ar time
195Processed saved messages in the queue at given intervals.
196If
197.Ar time
198is omitted,
199process the queue once.
200.Xr Time
201is given as a tagged number,
202with
203.Ql s
204being seconds,
205.Ql m
206being minutes,
207.Ql h
208being hours,
209.Ql d
210being days,
211and
212.Ql w
213being weeks.
214For example,
215.Ql \-q1h30m
216or
217.Ql \-q90m
218would both set the timeout to one hour thirty minutes.
219If
220.Ar time
221is specified,
222.Nm sendmail
223will run in background.
224This option can be used safely with
225.Fl bd .
226.It Fl qI Ns Ar substr
227Limit processed jobs to those containing
228.Ar substr
229as a substring of the queue id.
230.It Fl qR Ns Ar substr
231Limit processed jobs to those containing
232.Ar substr
233as a substring of one of the recipients.
234.It Fl qS Ns Ar substr
235Limit processed jobs to those containing
236.Ar substr
237as a substring of the sender.
238.It Fl R Ar return
239Set the amount of the message to be returned
240if the message bounces.
241The
242.Ar return
243parameter can be
244.Ql full
245to return the entire message or
246.Ql hdrs
247to return only the headers.
248.It Fl r Ns Ar name
249An alternate and obsolete form of the
250.Fl f
251flag.
252.It Fl t
253Read message for recipients.
254To:, Cc:, and Bcc: lines will be scanned for recipient addresses.
255The Bcc: line will be deleted before transmission.
256.It Fl U
257Initial (user) submission.
258This should
259.Em always
260be set when called from a user agent such as
261.Nm Mail
262or
263.Nm exmh
264and
265.Em never
266be set when called by a network delivery agent such as
267.Nm rmail .
268.It Fl V Ar envid
269Set the original envelope id.
270This is propagated across SMTP to servers that support DSNs
271and is returned in DSN-compliant error messages.
272.It Fl v
273Go into verbose mode.
274Alias expansions will be announced, etc.
275.It Fl X Ar logfile
276Log all traffic in and out of mailers in the indicated log file.
277This should only be used as a last resort
278for debugging mailer bugs.
279It will log a lot of data very quickly.
280.El
281.Ss Options
282There are also a number of processing options that may be set.
283Normally these will only be used by a system administrator.
284Options may be set either on the command line
285using the
286.Fl o
287flag (for short names),
288the
289.Fl O
290flag (for long names),
291or in the configuration file.
292This is a partial list limited to those options that are likely to be useful
293on the command line
294and only shows the long names;
295for a complete list (and details), consult the
296.%T "Sendmail Installation and Operation Guide" .
297The options are:
298.Bl -tag -width Fl
299.It Li AliasFile= Ns Ar file
300Use alternate alias file.
301.It Li HoldExpensive
302On mailers that are considered ``expensive'' to connect to,
303don't initiate immediate connection.
304This requires queueing.
305.It Li CheckpointInterval= Ns Ar N
306Checkpoint the queue file after every
307.Ar N
308successful deliveries (default 10).
309This avoids excessive duplicate deliveries
310when sending to long mailing lists
311interrupted by system crashes.
312.ne 1i
313.It Li DeliveryMode= Ns Ar x
314Set the delivery mode to
315.Ar x .
316Delivery modes are
317.Ql i
318for interactive (synchronous) delivery,
319.Ql b
320for background (asynchronous) delivery,
321.Ql q
322for queue only \- i.e.,
323actual delivery is done the next time the queue is run, and
324.Ql d
325for deferred \- the same as
326.Ql q
327except that database lookups (notably DNS and NIS lookups) are avoided.
328.It Li ErrorMode= Ns Ar x
329Set error processing to mode
330.Ar x .
331Valid modes are
332.Ql m
333to mail back the error message,
334.Ql w
335to ``write'' back the error message
336(or mail it back if the sender is not logged in),
337.Ql p
338to print the errors on the terminal
339(default),
340.Ql q
341to throw away error messages
342(only exit status is returned),
343and
344.Ql e
345to do special processing for the BerkNet.
346If the text of the message is not mailed back
347by
348modes
349.Ql m
350or
351.Ql w
352and if the sender is local to this machine,
353a copy of the message is appended to the file
354.Pa dead.letter
355in the sender's home directory.
356.It Li SaveFromLine
357Save
358.Tn UNIX Ns \-style
359From lines at the front of messages.
360.It Li MaxHopCount= Ar N
361The maximum number of times a message is allowed to ``hop''
362before we decide it is in a loop.
363.It Li IgnoreDots
364Do not take dots on a line by themselves
365as a message terminator.
366.It Li SendMimeErrors
367Send error messages in MIME format.
368If not set, the DSN (Delivery Status Notification) SMTP extension
369is disabled.
370.It Li ConnectionCacheTimeout= Ns Ar timeout
371Set connection cache timeout.
372.It Li ConnectionCacheSize= Ns Ar N
373Set connection cache size.
374.It Li LogLevel= Ns Ar n
375The log level.
376.It Li MeToo
377Send to ``me'' (the sender) also if I am in an alias expansion.
378.It Li CheckAliases
379Validate the right hand side of aliases during a
380.Xr newaliases 1
381command.
382.It Li OldStyleHeaders
383If set, this message may have
384old style headers.
385If not set,
386this message is guaranteed to have new style headers
387(i.e., commas instead of spaces between addresses).
388If set, an adaptive algorithm is used that will correctly
389determine the header format in most cases.
390.It Li QueueDirectory= Ns Ar queuedir
391Select the directory in which to queue messages.
392.It Li StatusFile= Ns Ar file
393Save statistics in the named file.
394.It Li Timeout.queuereturn= Ns Ar time
395Set the timeout on undelivered messages in the queue to the specified time.
396After delivery has failed
397(e.g., because of a host being down)
398for this amount of time,
399failed messages will be returned to the sender.
400The default is five days.
401.It Li UserDatabaseSpec= Ns Ar userdatabase
402If set, a user database is consulted to get forwarding information.
403You can consider this an adjunct to the aliasing mechanism,
404except that the database is intended to be distributed;
405aliases are local to a particular host.
406This may not be available if your sendmail does not have the
407.Dv USERDB
408option compiled in.
409.It Li ForkEachJob
410Fork each job during queue runs.
411May be convenient on memory-poor machines.
412.It Li SevenBitInput
413Strip incoming messages to seven bits.
414.It Li EightBitMode= Ns Ar mode
415Set the handling of eight bit input to seven bit destinations to
416.Ar mode :
417.Li m
418(mimefy) will convert to seven-bit MIME format,
419.Li p
420(pass) will pass it as eight bits (but violates protocols),
421and
422.Li s
423(strict) will bounce the message.
424.It Li MinQueueAge= Ns Ar timeout
425Sets how long a job must ferment in the queue between attempts to send it.
426.It Li DefaultCharSet= Ns Ar charset
427Sets the default character set used to label 8-bit data
428that is not otherwise labelled.
429.It Li DialDelay= Ns Ar sleeptime
430If opening a connection fails,
431sleep for
432.Ar sleeptime
433seconds and try again.
434Useful on dial-on-demand sites.
435.It Li NoRecipientAction= Ns Ar action
436Set the behaviour when there are no recipient headers (To:, Cc: or Bcc:)
437in the message to
438.Ar action :
439.Li none
440leaves the message unchanged,
441.Li add-to
442adds a To: header with the envelope recipients,
443.Li add-apparently-to
444adds an Apparently-To: header with the envelope recipients,
445.Li add-bcc
446adds an empty Bcc: header, and
447.Li add-to-undisclosed
448adds a header reading
449.Ql "To: undisclosed-recipients:;" .
450.It Li MaxDaemonChildren= Ns Ar N
451Sets the maximum number of children that an incoming SMTP daemon
452will allow to spawn at any time to
453.Ar N .
454.It Li ConnectionRateThrottle= Ns Ar N
455Sets the maximum number of connections per second to the SMTP port to
456.Ar N .
457.El
458.Pp
459In aliases,
460the first character of a name may be
461a vertical bar to cause interpretation of
462the rest of the name as a command
463to pipe the mail to.
464It may be necessary to quote the name
465to keep
466.Nm sendmail
467from suppressing the blanks from between arguments.
468For example, a common alias is:
469.Pp
470.Bd -literal -offset indent -compact
471msgs: "|/usr/bin/msgs -s"
472.Ed
473.Pp
474Aliases may also have the syntax
475.Dq :include: Ns Ar filename
476to ask
477.Xr sendmail
478to read the named file for a list of recipients.
479For example, an alias such as:
480.Pp
481.Bd -literal -offset indent -compact
482poets: ":include:/usr/local/lib/poets.list"
483.Ed
484.Pp
485would read
486.Pa /usr/local/lib/poets.list
487for the list of addresses making up the group.
488.Pp
489.Nm Sendmail
490returns an exit status
491describing what it did.
492The codes are defined in
493.Aq Pa sysexits.h :
494.Bl -tag -width EX_UNAVAILABLE -compact -offset indent
495.It Dv EX_OK
496Successful completion on all addresses.
497.It Dv EX_NOUSER
498User name not recognized.
499.It Dv EX_UNAVAILABLE
500Catchall meaning necessary resources
501were not available.
502.It Dv EX_SYNTAX
503Syntax error in address.
504.It Dv EX_SOFTWARE
505Internal software error,
506including bad arguments.
507.It Dv EX_OSERR
508Temporary operating system error,
509such as
510.Dq cannot fork .
511.It Dv EX_NOHOST
512Host name not recognized.
513.It Dv EX_TEMPFAIL
514Message could not be sent immediately,
515but was queued.
516.El
517.Pp
518If invoked as
519.Nm newaliases ,
520.Nm sendmail
521will rebuild the alias database.
522If invoked as
523.Nm mailq ,
524.Nm sendmail
525will print the contents of the mail queue.
526.Sh FILES
527Except for the file
528.Pa /etc/sendmail.cf
529itself and the daemon process ID file,
530the following pathnames are all specified in
531.Pa /etc/sendmail.cf.
532Thus,
533these values are only approximations.
534.Pp
535.Bl -tag -width /usr/lib/sendmail.fc -compact
536.It Pa /etc/aliases
537raw data for alias names
538.It Pa /etc/aliases.db
539data base of alias names
540.It Pa /etc/sendmail.cf
541configuration file
542.It Pa /usr/share/misc/sendmail.hf
543help file
544.It Pa /var/log/sendmail.st
545collected statistics
546.It Pa /var/spool/mqueue/*
547temp files
548.El
549.Sh SEE ALSO
550.Xr mail 1 ,
551.Xr syslog 3 ,
552.Xr aliases 5 ,
553.Xr mailaddr 7 ,
554.Xr mail.local 8 ,
555.Xr rc 8 ,
556.Xr rmail 8 ;
557.Pp
558DARPA
559Internet Request For Comments
560.%T RFC819 ,
561.%T RFC821 ,
562.%T RFC822 .
563.Rs
564.%T "Sendmail \- An Internetwork Mail Router"
565.%V SMM
566.%N \&No. 9
567.Re
568.Rs
569.%T "Sendmail Installation and Operation Guide"
570.%V SMM
571.%N \&No. 8
572.Re
573.Sh HISTORY
574The
575.Nm
576command appeared in
577.Bx 4.2 .
578