]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/blob - contrib/sendmail/src/sendmail.8
Merge commit '850ef5ae11d69ea3381bd310f564f025fc8caea3'
[FreeBSD/FreeBSD.git] / contrib / sendmail / src / sendmail.8
1 .\" Copyright (c) 1998-2003 Proofpoint, Inc. and its suppliers.
2 .\"      All rights reserved.
3 .\" Copyright (c) 1983, 1997 Eric P. Allman.  All rights reserved.
4 .\" Copyright (c) 1988, 1991, 1993
5 .\"     The Regents of the University of California.  All rights reserved.
6 .\"
7 .\" By using this file, you agree to the terms and conditions set
8 .\" forth in the LICENSE file which can be found at the top level of
9 .\" the sendmail distribution.
10 .\"
11 .\"
12 .\"     $Id: sendmail.8,v 8.61 2013-11-22 20:51:56 ca Exp $
13 .\"
14 .TH SENDMAIL 8 "$Date: 2013-11-22 20:51:56 $"
15 .SH NAME
16 sendmail
17 \- an electronic mail transport agent
18 .SH SYNOPSIS
19 .B sendmail
20 .RI [ flags "] [" "address ..." ]
21 .br
22 .B newaliases
23 .br
24 .B mailq
25 .RB [ \-v ]
26 .br
27 .B hoststat
28 .br
29 .B purgestat
30 .br
31 .B smtpd
32 .SH DESCRIPTION
33 .B Sendmail
34 sends a message to one or more
35 .I recipients,
36 routing the message over whatever networks
37 are necessary.
38 .B Sendmail
39 does internetwork forwarding as necessary
40 to deliver the message to the correct place.
41 .PP
42 .B Sendmail
43 is not intended as a user interface routine;
44 other programs provide user-friendly
45 front ends;
46 .B sendmail
47 is used only to deliver pre-formatted messages.
48 .PP
49 With no flags,
50 .B sendmail
51 reads its standard input
52 up to an end-of-file
53 or a line consisting only of a single dot
54 and sends a copy of the message found there
55 to all of the addresses listed.
56 It determines the network(s) to use
57 based on the syntax and contents of the addresses.
58 .PP
59 Local addresses are looked up in a file
60 and aliased appropriately.
61 Aliasing can be prevented by preceding the address
62 with a backslash.
63 Beginning with 8.10, the sender is included in any alias
64 expansions, e.g.,
65 if `john' sends to `group',
66 and `group' includes `john' in the expansion,
67 then the letter will also be delivered to `john'.
68 .SS Parameters
69 .TP
70 .B \-Ac
71 Use submit.cf even if the operation mode does not indicate
72 an initial mail submission.
73 .TP
74 .B \-Am
75 Use sendmail.cf even if the operation mode indicates
76 an initial mail submission.
77 .TP
78 .BI \-B type
79 Set the body type to
80 .IR type .
81 Current legal values are
82 7BIT
83 or
84 8BITMIME.
85 .TP
86 .B \-ba
87 Go into
88 ARPANET
89 mode.
90 All input lines must end with a CRLF,
91 and all messages will be generated with a CRLF at the end.
92 Also,
93 the ``From:'' and ``Sender:''
94 fields are examined for the name of the sender.
95 .TP
96 .B \-bC
97 Check the configuration file.
98 .TP
99 .B \-bd
100 Run as a daemon.
101 .B Sendmail
102 will fork and run in background
103 listening on socket 25 for incoming
104 SMTP
105 connections.
106 This is normally run from
107 /etc/rc.
108 .TP
109 .B \-bD
110 Same as
111 .B \-bd
112 except runs in foreground.
113 .TP
114 .B \-bh
115 Print the persistent host status database.
116 .TP
117 .B \-bH
118 Purge expired entries from the persistent host status database.
119 .TP
120 .B \-bi
121 Initialize the alias database.
122 .TP
123 .B \-bm
124 Deliver mail in the usual way (default).
125 .TP
126 .B \-bp
127 Print a listing of the queue(s).
128 .TP
129 .B \-bP
130 Print number of entries in the queue(s);
131 only available with shared memory support.
132 .TP
133 .B \-bs
134 Use the
135 SMTP
136 protocol as described in
137 RFC821
138 on standard input and output.
139 This flag implies all the operations of the
140 .B \-ba
141 flag that are compatible with
142 SMTP.
143 .TP
144 .B \-bt
145 Run in address test mode.
146 This mode reads addresses and shows the steps in parsing;
147 it is used for debugging configuration tables.
148 .TP
149 .B \-bv
150 Verify names only \- do not try to collect or deliver a message.
151 Verify mode is normally used for validating
152 users or mailing lists.
153 .TP
154 .BI \-C file
155 Use alternate configuration file.
156 .B Sendmail
157 gives up any enhanced (set-user-ID or set-group-ID) privileges
158 if an alternate configuration file is specified.
159 .TP
160 .BI "\-D " logfile
161 Send debugging output to the indicated log file instead of stdout.
162 .TP
163 .BI \-d category . level...
164 Set the debugging flag for
165 .I category
166 to
167 .IR level .
168 .I Category
169 is either an integer or a name specifying the topic, and
170 .I level
171 an integer specifying the level of debugging output desired.
172 Higher levels generally mean more output.
173 More than one flag can be specified by separating them with commas.
174 A list of numeric debugging categories can be found in the TRACEFLAGS file
175 in the sendmail source distribution.
176 .br
177 The option
178 .B \-d0.1
179 prints the version of
180 .B sendmail
181 and the options it was compiled with.
182 .br
183 Most other categories are only useful with, and documented in,
184 .BR sendmail 's
185 source code.
186 .ne 1i
187 .TP
188 .BI \-F fullname
189 Set the full name of the sender.
190 .TP
191 .BI \-f name
192 Sets the name of the ``from'' person
193 (i.e., the envelope sender of the mail).
194 This address may also be used in the From: header
195 if that header is missing during initial submission.
196 The envelope sender address is used as the recipient
197 for delivery status notifications
198 and may also appear in a Return-Path: header.
199 .B \-f
200 should only be used
201 by ``trusted'' users
202 (normally
203 .IR root ", " daemon ,
204 and
205 .IR network )
206 or if the person you are trying to become
207 is the same as the person you are.
208 Otherwise,
209 an X-Authentication-Warning header
210 will be added to the message.
211 .TP
212 .BI \-G
213 Relay (gateway) submission of a message,
214 e.g., when
215 .BR rmail
216 calls
217 .B sendmail .
218 .TP
219 .BI \-h N
220 Set the hop count to
221 .IR N .
222 The hop count is incremented every time the mail is processed.
223 When it reaches a limit,
224 the mail is returned with an error message,
225 the victim of an aliasing loop.
226 If not specified,
227 ``Received:'' lines in the message are counted.
228 .TP
229 .B \-i
230 Do not strip a leading dot from lines in incoming messages,
231 and do not treat a dot on a line by itself
232 as the end of an incoming message.
233 This should be set if you are reading data from a file.
234 .TP
235 .BI "\-L " tag
236 Set the identifier used in syslog messages to the supplied
237 .IR tag .
238 .TP
239 .BI "\-N " dsn
240 Set delivery status notification conditions to
241 .IR dsn ,
242 which can be
243 `never'
244 for no notifications
245 or a comma separated list of the values
246 `failure'
247 to be notified if delivery failed,
248 `delay'
249 to be notified if delivery is delayed, and
250 `success'
251 to be notified when the message is successfully delivered.
252 .TP
253 .B \-n
254 Don't do aliasing.
255 .TP
256 \fB\-O\fP \fIoption\fR=\fIvalue\fR
257 Set option
258 .I option
259 to the specified
260 .IR value .
261 This form uses long names.  See below for more details.
262 .TP
263 .BI \-o "x value"
264 Set option
265 .I x
266 to the specified
267 .IR value .
268 This form uses single character names only.
269 The short names are not described in this manual page;
270 see the
271 .I "Sendmail Installation and Operation Guide"
272 for details.
273 .TP
274 .BI \-p protocol
275 Set the name of the protocol used to receive the message.
276 This can be a simple protocol name such as ``UUCP''
277 or a protocol and hostname, such as ``UUCP:ucbvax''.
278 .TP
279 \fB\-q\fR[\fItime\fR]
280 Process saved messages in the queue at given intervals.
281 If
282 .I time
283 is omitted, process the queue once.
284 .I Time
285 is given as a tagged number,
286 with
287 `s'
288 being seconds,
289 `m'
290 being minutes (default),
291 `h'
292 being hours,
293 `d'
294 being days,
295 and
296 `w'
297 being weeks.
298 For example,
299 `\-q1h30m'
300 or
301 `\-q90m'
302 would both set the timeout to one hour thirty minutes.
303 By default,
304 .B sendmail
305 will run in the background.
306 This option can be used safely with
307 .BR \-bd .
308 .TP
309 \fB\-qp\fR[\fItime\fR]
310 Similar to \fB\-q\fItime\fR,
311 except that instead of periodically forking a child to process the queue,
312 sendmail forks a single persistent child for each queue
313 that alternates between processing the queue and sleeping.
314 The sleep time is given as the argument; it defaults to 1 second.
315 The process will always sleep at least 5 seconds if the queue was
316 empty in the previous queue run.
317 .TP
318 \fB\-q\fRf
319 Process saved messages in the queue once and do not fork(),
320 but run in the foreground.
321 .TP
322 \fB\-q\fRG\fIname\fR
323 Process jobs in queue group called
324 .I name
325 only.
326 .TP
327 \fB\-q\fR[\fI!\fR]I\fIsubstr\fR
328 Limit processed jobs to those containing
329 .I substr
330 as a substring of the queue id or not when
331 .I !
332 is specified.
333 .TP
334 \fB\-q\fR[\fI!\fR]Q\fIsubstr\fR
335 Limit processed jobs to quarantined jobs containing
336 .I substr
337 as a substring of the quarantine reason or not when
338 .I !
339 is specified.
340 .TP
341 \fB\-q\fR[\fI!\fR]R\fIsubstr\fR
342 Limit processed jobs to those containing
343 .I substr
344 as a substring of one of the recipients or not when
345 .I !
346 is specified.
347 .TP
348 \fB\-q\fR[\fI!\fR]S\fIsubstr\fR
349 Limit processed jobs to those containing
350 .I substr
351 as a substring of the sender or not when
352 .I !
353 is specified.
354 .TP
355 \fB\-Q\fR[reason]
356 Quarantine a normal queue items with the given reason or
357 unquarantine quarantined queue items if no reason is given.
358 This should only be used with some sort of item matching using
359 as described above.
360 .TP
361 .BI "\-R " return
362 Set the amount of the message to be returned
363 if the message bounces.
364 The
365 .I return
366 parameter can be
367 `full'
368 to return the entire message or
369 `hdrs'
370 to return only the headers.
371 In the latter case also local bounces return only the headers.
372 .TP
373 .BI \-r name
374 An alternate and obsolete form of the
375 .B \-f
376 flag.
377 .TP
378 .B \-t
379 Read message for recipients.
380 To:, Cc:, and Bcc: lines will be scanned for recipient addresses.
381 The Bcc: line will be deleted before transmission.
382 .TP
383 .B \-U
384 If a mail submission via the command line requires the use of the
385 .B SMTPUTF8
386 argument for the
387 .B MAIL
388 command,
389 e.g., because a header uses UTF-8 encoding,
390 but the addresses on the command line are all ASCII,
391 then this option must be used.
392 Only available if
393 .B EAI
394 support is enabled,
395 and the
396 .B SMTPUTF8
397 option is set.
398 .TP
399 .BI "\-V " envid
400 Set the original envelope id.
401 This is propagated across SMTP to servers that support DSNs
402 and is returned in DSN-compliant error messages.
403 .TP
404 .B \-v
405 Go into verbose mode.
406 Alias expansions will be announced, etc.
407 .TP
408 .BI "\-X " logfile
409 Log all traffic in and out of mailers in the indicated log file.
410 This should only be used as a last resort
411 for debugging mailer bugs.
412 It will log a lot of data very quickly.
413 .TP
414 .B \-\-
415 Stop processing command flags and use the rest of the arguments as
416 addresses.
417 .SS Options
418 There are also a number of processing options that may be set.
419 Normally these will only be used by a system administrator.
420 Options may be set either on the command line
421 using the
422 .B \-o
423 flag (for short names), the
424 .B \-O
425 flag (for long names),
426 or in the configuration file.
427 This is a partial list limited to those options that are likely to be useful
428 on the command line
429 and only shows the long names;
430 for a complete list (and details), consult the
431 .IR "Sendmail Installation and Operation Guide" .
432 The options are:
433 .TP
434 .RI AliasFile= file
435 Use alternate alias file.
436 .TP
437 HoldExpensive
438 On mailers that are considered ``expensive'' to connect to,
439 don't initiate immediate connection.
440 This requires queueing.
441 .TP
442 .RI CheckpointInterval= N
443 Checkpoint the queue file after every
444 .I N
445 successful deliveries (default 10).
446 This avoids excessive duplicate deliveries
447 when sending to long mailing lists
448 interrupted by system crashes.
449 .ne 1i
450 .TP
451 .RI DeliveryMode= x
452 Set the delivery mode to
453 .IR x .
454 Delivery modes are
455 `i'
456 for interactive (synchronous) delivery,
457 `b'
458 for background (asynchronous) delivery,
459 `q'
460 for queue only \- i.e.,
461 actual delivery is done the next time the queue is run, and
462 `d'
463 for deferred \- the same as
464 `q'
465 except that database lookups for maps which have set the \-D option
466 (default for the host map) are avoided.
467 .TP
468 .RI ErrorMode= x
469 Set error processing to mode
470 .IR x .
471 Valid modes are
472 `m'
473 to mail back the error message,
474 `w'
475 to ``write''
476 back the error message
477 (or mail it back if the sender is not logged in),
478 `p'
479 to print the errors on the terminal
480 (default),
481 `q'
482 to throw away error messages
483 (only exit status is returned),
484 and
485 `e'
486 to do special processing for the BerkNet.
487 If the text of the message is not mailed back
488 by modes
489 `m'
490 or
491 `w'
492 and if the sender is local to this machine,
493 a copy of the message is appended to the file
494 .I dead.letter
495 in the sender's home directory.
496 .TP
497 SaveFromLine
498 Save
499 UNIX-style
500 From lines at the front of messages.
501 .TP
502 .RI MaxHopCount= N
503 The maximum number of times a message is allowed to ``hop''
504 before we decide it is in a loop.
505 .TP
506 IgnoreDots
507 Do not take dots on a line by themselves
508 as a message terminator.
509 .TP
510 SendMimeErrors
511 Send error messages in MIME format.
512 If not set, the DSN (Delivery Status Notification) SMTP extension
513 is disabled.
514 .TP
515 .RI ConnectionCacheTimeout= timeout
516 Set connection cache timeout.
517 .TP
518 .RI ConnectionCacheSize= N
519 Set connection cache size.
520 .TP
521 .RI LogLevel= n
522 The log level.
523 .TP
524 .RI MeToo= False
525 Don't send to ``me'' (the sender) if I am in an alias expansion.
526 .TP
527 CheckAliases
528 Validate the right hand side of aliases during a
529 newaliases(1)
530 command.
531 .TP
532 OldStyleHeaders
533 If set, this message may have
534 old style headers.
535 If not set,
536 this message is guaranteed to have new style headers
537 (i.e., commas instead of spaces between addresses).
538 If set, an adaptive algorithm is used that will correctly
539 determine the header format in most cases.
540 .TP
541 .RI QueueDirectory= queuedir
542 Select the directory in which to queue messages.
543 .TP
544 .RI StatusFile= file
545 Save statistics in the named file.
546 .TP
547 .RI Timeout.queuereturn= time
548 Set the timeout on undelivered messages in the queue to the specified time.
549 After delivery has failed
550 (e.g., because of a host being down)
551 for this amount of time,
552 failed messages will be returned to the sender.
553 The default is five days.
554 .TP
555 .RI UserDatabaseSpec= userdatabase
556 If set, a user database is consulted to get forwarding information.
557 You can consider this an adjunct to the aliasing mechanism,
558 except that the database is intended to be distributed;
559 aliases are local to a particular host.
560 This may not be available if your sendmail does not have the
561 USERDB
562 option compiled in.
563 .TP
564 ForkEachJob
565 Fork each job during queue runs.
566 May be convenient on memory-poor machines.
567 .TP
568 SevenBitInput
569 Strip incoming messages to seven bits.
570 .TP
571 .RI EightBitMode= mode
572 Set the handling of eight bit input to seven bit destinations to
573 .IR mode :
574 m
575 (mimefy) will convert to seven-bit MIME format,
576 p
577 (pass) will pass it as eight bits (but violates protocols),
578 and
579 s
580 (strict) will bounce the message.
581 .TP
582 .RI MinQueueAge= timeout
583 Sets how long a job must ferment in the queue between attempts to send it.
584 .TP
585 .RI DefaultCharSet= charset
586 Sets the default character set used to label 8-bit data
587 that is not otherwise labelled.
588 .TP
589 .RI NoRecipientAction= action
590 Set the behaviour when there are no recipient headers (To:, Cc: or
591 Bcc:) in the message to
592 .IR action :
593 none
594 leaves the message unchanged,
595 add-to
596 adds a To: header with the envelope recipients,
597 add-apparently-to
598 adds an Apparently-To: header with the envelope recipients,
599 add-bcc
600 adds an empty Bcc: header, and
601 add-to-undisclosed
602 adds a header reading
603 `To: undisclosed-recipients:;'.
604 .TP
605 .RI MaxDaemonChildren= N
606 Sets the maximum number of children that an incoming SMTP daemon
607 will allow to spawn at any time to
608 .IR N .
609 .TP
610 .RI ConnectionRateThrottle= N
611 Sets the maximum number of connections per second to the SMTP port to
612 .IR N .
613 .PP
614 In aliases,
615 the first character of a name may be
616 a vertical bar to cause interpretation of
617 the rest of the name as a command
618 to pipe the mail to.
619 It may be necessary to quote the name to keep
620 .B sendmail
621 from suppressing the blanks from between arguments.
622 For example, a common alias is:
623 .IP
624 msgs: "|/usr/bin/msgs -s"
625 .PP
626 Aliases may also have the syntax
627 .RI ``:include: filename ''
628 to ask
629 .B sendmail
630 to read the named file for a list of recipients.
631 For example, an alias such as:
632 .IP
633 poets: ":include:/usr/local/lib/poets.list"
634 .PP
635 would read
636 .I /usr/local/lib/poets.list
637 for the list of addresses making up the group.
638 .PP
639 .B Sendmail
640 returns an exit status describing what it did.
641 The codes are defined in
642 .RI < sysexits.h >:
643 .TP
644 EX_OK
645 Successful completion on all addresses.
646 .TP
647 EX_NOUSER
648 User name not recognized.
649 .TP
650 EX_UNAVAILABLE
651 Catchall meaning necessary resources
652 were not available.
653 .TP
654 EX_SYNTAX
655 Syntax error in address.
656 .TP
657 EX_SOFTWARE
658 Internal software error,
659 including bad arguments.
660 .TP
661 EX_OSERR
662 Temporary operating system error,
663 such as
664 ``cannot fork''.
665 .TP
666 EX_NOHOST
667 Host name not recognized.
668 .TP
669 EX_TEMPFAIL
670 Message could not be sent immediately,
671 but was queued.
672 .PP
673 If invoked as
674 .BR newaliases ,
675 .B sendmail
676 will rebuild the alias database.  If invoked as
677 .BR mailq ,
678 .B sendmail
679 will print the contents of the mail queue.
680 If invoked as
681 .BR hoststat ,
682 .B sendmail
683 will print the persistent host status database.
684 If invoked as
685 .BR purgestat ,
686 .B sendmail
687 will purge expired entries from the persistent host status database.
688 If invoked as
689 .BR smtpd ,
690 .B sendmail
691 will act as a daemon, as if the
692 .B \-bd
693 option were specified.
694 .SH NOTES
695 .B sendmail
696 often gets blamed for many problems
697 that are actually the result of other problems,
698 such as overly permissive modes on directories.
699 For this reason,
700 .B sendmail
701 checks the modes on system directories and files
702 to determine if they can be trusted.
703 Although these checks can be turned off
704 and your system security reduced by setting the
705 .BR DontBlameSendmail
706 option,
707 the permission problems should be fixed.
708 For more information, see the
709 .I "Sendmail Installation and Operation Guide"
710 .SH FILES
711 Except for the file
712 .I /etc/mail/sendmail.cf
713 itself the following pathnames are all specified in
714 .IR /etc/mail/sendmail.cf .
715 Thus,
716 these values are only approximations.
717 .PP
718 .TP
719  /etc/mail/aliases
720 raw data for alias names
721 .TP
722  /etc/mail/aliases.db
723 data base of alias names
724 .TP
725  /etc/mail/sendmail.cf
726 configuration file
727 .TP
728  /etc/mail/helpfile
729 help file
730 .TP
731  /etc/mail/statistics
732 collected statistics
733 .TP
734  /var/spool/mqueue/*
735 temp files
736 .SH SEE ALSO
737 mail(1),
738 syslog(3),
739 aliases(5),
740 mailaddr(7),
741 mail.local(8),
742 rc(8),
743 rmail(8)
744 .PP
745 DARPA
746 Internet Request For Comments
747 .IR RFC819 ,
748 .IR RFC821 ,
749 .IR RFC822 .
750 .IR "Sendmail Installation and Operation Guide" ,
751 No. 8, SMM.
752 .PP
753 http://www.sendmail.org/
754 .PP
755 US Patent Numbers 6865671, 6986037.
756 .SH HISTORY
757 The
758 .B sendmail
759 command appeared in
760 4.2BSD.
761 .\" $FreeBSD$