]> CyberLeo.Net >> Repos - FreeBSD/releng/10.2.git/blob - contrib/sendmail/src/sendmail.8
- Copy stable/10@285827 to releng/10.2 in preparation for 10.2-RC1
[FreeBSD/releng/10.2.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.  All input lines must end with a CR-LF, 
90 and all messages will be generated with a CR-LF at the end.  
91 Also, 
92 the ``From:'' and ``Sender:'' 
93 fields are examined for the name of the sender.
94 .TP
95 .B \-bC
96 Check the configuration file.
97 .TP
98 .B \-bd
99 Run as a daemon.
100 .B Sendmail
101 will fork and run in background 
102 listening on socket 25 for incoming
103 SMTP 
104 connections.  
105 This is normally run from 
106 /etc/rc.
107 .TP
108 .B \-bD
109 Same as
110 .B \-bd
111 except runs in foreground.
112 .TP
113 .B \-bh
114 Print the persistent host status database.
115 .TP
116 .B \-bH
117 Purge expired entries from the persistent host status database.
118 .TP
119 .B \-bi
120 Initialize the alias database.
121 .TP
122 .B \-bm
123 Deliver mail in the usual way (default).
124 .TP
125 .B \-bp
126 Print a listing of the queue(s).
127 .TP
128 .B \-bP
129 Print number of entries in the queue(s);
130 only available with shared memory support.
131 .TP
132 .B \-bs
133 Use the 
134 SMTP 
135 protocol as described in 
136 RFC821 
137 on standard input and output.  
138 This flag implies all the operations of the
139 .B \-ba
140 flag that are compatible with 
141 SMTP.
142 .TP
143 .B \-bt
144 Run in address test mode.  
145 This mode reads addresses and shows the steps in parsing; 
146 it is used for debugging configuration tables.
147 .TP
148 .B \-bv
149 Verify names only \- do not try to collect or deliver a message.
150 Verify mode is normally used for validating 
151 users or mailing lists.
152 .TP
153 .BI \-C file
154 Use alternate configuration file.
155 .B Sendmail
156 gives up any enhanced (set-user-ID or set-group-ID) privileges
157 if an alternate configuration file is specified.
158 .TP
159 .BI "\-D " logfile
160 Send debugging output to the indicated log file instead of stdout.
161 .TP
162 .BI \-d category . level...
163 Set the debugging flag for
164 .I category
165 to
166 .IR level .
167 .I Category
168 is either an integer or a name specifying the topic, and
169 .I level
170 an integer specifying the level of debugging output desired.
171 Higher levels generally mean more output.
172 More than one flag can be specified by separating them with commas.
173 A list of numeric debugging categories can be found in the TRACEFLAGS file
174 in the sendmail source distribution.
175 .br
176 The option
177 .B \-d0.1
178 prints the version of
179 .B sendmail
180 and the options it was compiled with.
181 .br
182 Most other categories are only useful with, and documented in,
183 .BR sendmail 's
184 source code.
185 .ne 1i
186 .TP
187 .BI \-F fullname
188 Set the full name of the sender.
189 .TP
190 .BI \-f name
191 Sets the name of the ``from'' person 
192 (i.e., the envelope sender of the mail).
193 This address may also be used in the From: header
194 if that header is missing during initial submission.
195 The envelope sender address is used as the recipient
196 for delivery status notifications
197 and may also appear in a Return-Path: header.
198 .B \-f
199 should only be used 
200 by ``trusted'' users 
201 (normally
202 .IR root ", " daemon ,
203 and
204 .IR network )
205 or if the person you are trying to become 
206 is the same as the person you are.
207 Otherwise,
208 an X-Authentication-Warning header
209 will be added to the message.
210 .TP
211 .BI \-G
212 Relay (gateway) submission of a message,
213 e.g., when
214 .BR rmail
215 calls
216 .B sendmail .
217 .TP
218 .BI \-h N
219 Set the hop count to
220 .IR N .
221 The hop count is incremented every time the mail is 
222 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 .BI "\-V " envid
384 Set the original envelope id.  
385 This is propagated across SMTP to servers that support DSNs 
386 and is returned in DSN-compliant error messages.
387 .TP
388 .B \-v
389 Go into verbose mode.  
390 Alias expansions will be announced, etc.
391 .TP
392 .BI "\-X " logfile
393 Log all traffic in and out of mailers in the indicated log file.
394 This should only be used as a last resort 
395 for debugging mailer bugs.  
396 It will log a lot of data very quickly.
397 .TP
398 .B \-\-
399 Stop processing command flags and use the rest of the arguments as
400 addresses.
401 .SS Options
402 There are also a number of processing options that may be set.
403 Normally these will only be used by a system administrator.  
404 Options may be set either on the command line 
405 using the
406 .B \-o
407 flag (for short names), the
408 .B \-O
409 flag (for long names), 
410 or in the configuration file.  
411 This is a partial list limited to those options that are likely to be useful
412 on the command line 
413 and only shows the long names; 
414 for a complete list (and details), consult the
415 .IR "Sendmail Installation and Operation Guide" .
416 The options are:
417 .TP
418 .RI AliasFile= file
419 Use alternate alias file.
420 .TP
421 HoldExpensive 
422 On mailers that are considered ``expensive'' to connect to, 
423 don't initiate immediate connection.  
424 This requires queueing.
425 .TP
426 .RI CheckpointInterval= N
427 Checkpoint the queue file after every
428 .I N
429 successful deliveries (default 10).  
430 This avoids excessive duplicate deliveries 
431 when sending to long mailing lists 
432 interrupted by system crashes.
433 .ne 1i
434 .TP
435 .RI DeliveryMode= x
436 Set the delivery mode to
437 .IR x .
438 Delivery modes are 
439 `i' 
440 for interactive (synchronous) delivery, 
441 `b'
442 for background (asynchronous) delivery, 
443 `q' 
444 for queue only \- i.e.,
445 actual delivery is done the next time the queue is run, and 
446 `d'
447 for deferred \- the same as 
448 `q' 
449 except that database lookups for maps which have set the \-D option
450 (default for the host map) are avoided.
451 .TP
452 .RI ErrorMode= x
453 Set error processing to mode
454 .IR x .
455 Valid modes are 
456 `m' 
457 to mail back the error message, 
458 `w' 
459 to ``write''
460 back the error message 
461 (or mail it back if the sender is not logged in), 
462 `p' 
463 to print the errors on the terminal 
464 (default), 
465 `q' 
466 to throw away error messages 
467 (only exit status is returned), 
468 and 
469 `e'
470 to do special processing for the BerkNet.  
471 If the text of the message is not mailed back 
472 by 
473 modes
474 `m'
475 or
476 `w'
477 and if the sender is local to this machine, 
478 a copy of the message is appended to the file
479 .I dead.letter
480 in the sender's home directory.
481 .TP
482 SaveFromLine
483 Save
484 UNIX-style
485 From lines at the front of messages.
486 .TP
487 .RI MaxHopCount= N
488 The maximum number of times a message is allowed to ``hop'' 
489 before we decide it is in a loop.
490 .TP
491 IgnoreDots
492 Do not take dots on a line by themselves 
493 as a message terminator.
494 .TP
495 SendMimeErrors
496 Send error messages in MIME format.  
497 If not set, the DSN (Delivery Status Notification) SMTP extension 
498 is disabled.
499 .TP
500 .RI ConnectionCacheTimeout= timeout
501 Set connection cache timeout.
502 .TP
503 .RI ConnectionCacheSize= N
504 Set connection cache size.
505 .TP
506 .RI LogLevel= n
507 The log level.
508 .TP
509 .RI MeToo= False
510 Don't send to ``me'' (the sender) if I am in an alias expansion.
511 .TP
512 CheckAliases
513 Validate the right hand side of aliases during a
514 newaliases(1)
515 command.
516 .TP
517 OldStyleHeaders
518 If set, this message may have 
519 old style headers.  
520 If not set, 
521 this message is guaranteed to have new style headers 
522 (i.e., commas instead of spaces between addresses).  
523 If set, an adaptive algorithm is used that will correctly 
524 determine the header format in most cases.
525 .TP
526 .RI QueueDirectory= queuedir
527 Select the directory in which to queue messages.
528 .TP
529 .RI StatusFile= file
530 Save statistics in the named file.
531 .TP
532 .RI Timeout.queuereturn= time
533 Set the timeout on undelivered messages in the queue to the specified time.  
534 After delivery has failed 
535 (e.g., because of a host being down) 
536 for this amount of time, 
537 failed messages will be returned to the sender.  
538 The default is five days.
539 .TP
540 .RI UserDatabaseSpec= userdatabase
541 If set, a user database is consulted to get forwarding information.
542 You can consider this an adjunct to the aliasing mechanism, 
543 except that the database is intended to be distributed; 
544 aliases are local to a particular host.  
545 This may not be available if your sendmail does not have the
546 USERDB
547 option compiled in.
548 .TP
549 ForkEachJob
550 Fork each job during queue runs.  
551 May be convenient on memory-poor machines.
552 .TP
553 SevenBitInput
554 Strip incoming messages to seven bits.
555 .TP
556 .RI EightBitMode= mode
557 Set the handling of eight bit input to seven bit destinations to
558 .IR mode :
559 m
560 (mimefy) will convert to seven-bit MIME format,
561 p
562 (pass) will pass it as eight bits (but violates protocols), 
563 and
564 s
565 (strict) will bounce the message.
566 .TP
567 .RI MinQueueAge= timeout
568 Sets how long a job must ferment in the queue between attempts to send it.
569 .TP
570 .RI DefaultCharSet= charset
571 Sets the default character set used to label 8-bit data 
572 that is not otherwise labelled.
573 .TP
574 .RI DialDelay= sleeptime
575 If opening a connection fails, 
576 sleep for
577 .I sleeptime
578 seconds and try again.  
579 Useful on dial-on-demand sites.
580 .TP
581 .RI NoRecipientAction= action
582 Set the behaviour when there are no recipient headers (To:, Cc: or
583 Bcc:) in the message to
584 .IR action :
585 none
586 leaves the message unchanged,
587 add-to
588 adds a To: header with the envelope recipients,
589 add-apparently-to
590 adds an Apparently-To: header with the envelope recipients,
591 add-bcc
592 adds an empty Bcc: header, and
593 add-to-undisclosed
594 adds a header reading
595 `To: undisclosed-recipients:;'.
596 .TP
597 .RI MaxDaemonChildren= N
598 Sets the maximum number of children that an incoming SMTP daemon
599 will allow to spawn at any time to
600 .IR N .
601 .TP
602 .RI ConnectionRateThrottle= N
603 Sets the maximum number of connections per second to the SMTP port to
604 .IR N .
605 .PP
606 In aliases, 
607 the first character of a name may be 
608 a vertical bar to cause interpretation of 
609 the rest of the name as a command 
610 to pipe the mail to.  
611 It may be necessary to quote the name 
612 to keep
613 .B sendmail
614 from suppressing the blanks from between arguments. 
615 For example, a common alias is:
616 .IP
617 msgs: "|/usr/bin/msgs -s"
618 .PP
619 Aliases may also have the syntax
620 .RI ``:include: filename ''
621 to ask
622 .B sendmail
623 to read the named file for a list of recipients.  
624 For example, an alias such as:
625 .IP
626 poets: ":include:/usr/local/lib/poets.list"
627 .PP
628 would read
629 .I /usr/local/lib/poets.list
630 for the list of addresses making up the group.
631 .PP
632 .B Sendmail
633 returns an exit status 
634 describing what it did.  
635 The codes are defined in
636 .RI < sysexits.h >:
637 .TP
638 EX_OK
639 Successful completion on all addresses.
640 .TP
641 EX_NOUSER
642 User name not recognized.
643 .TP
644 EX_UNAVAILABLE
645 Catchall meaning necessary resources 
646 were not available.
647 .TP
648 EX_SYNTAX
649 Syntax error in address.
650 .TP
651 EX_SOFTWARE
652 Internal software error, 
653 including bad arguments.
654 .TP
655 EX_OSERR
656 Temporary operating system error, 
657 such as
658 ``cannot fork''.
659 .TP
660 EX_NOHOST
661 Host name not recognized.
662 .TP
663 EX_TEMPFAIL
664 Message could not be sent immediately, 
665 but was queued.
666 .PP
667 If invoked as
668 .BR newaliases ,
669 .B sendmail
670 will rebuild the alias database.  If invoked as
671 .BR mailq ,
672 .B sendmail
673 will print the contents of the mail queue.
674 If invoked as
675 .BR hoststat ,
676 .B sendmail
677 will print the persistent host status database.
678 If invoked as
679 .BR purgestat ,
680 .B sendmail
681 will purge expired entries from the persistent host status database.
682 If invoked as
683 .BR smtpd ,
684 .B sendmail
685 will act as a daemon, as if the
686 .B \-bd
687 option were specified.
688 .SH NOTES
689 .B sendmail
690 often gets blamed for many problems
691 that are actually the result of other problems,
692 such as overly permissive modes on directories.
693 For this reason,
694 .B sendmail
695 checks the modes on system directories and files
696 to determine if they can be trusted.
697 Although these checks can be turned off
698 and your system security reduced by setting the
699 .BR DontBlameSendmail
700 option,
701 the permission problems should be fixed.
702 For more information, see:
703
704 .I http://www.sendmail.org/tips/DontBlameSendmail.html
705 .SH FILES
706 Except for the file
707 .I /etc/mail/sendmail.cf
708 itself the following pathnames are all specified in
709 .IR /etc/mail/sendmail.cf .
710 Thus, 
711 these values are only approximations.
712 .PP
713 .TP
714  /etc/mail/aliases
715 raw data for alias names
716 .TP
717  /etc/mail/aliases.db
718 data base of alias names
719 .TP
720  /etc/mail/sendmail.cf
721 configuration file
722 .TP
723  /etc/mail/helpfile
724 help file
725 .TP
726  /etc/mail/statistics
727 collected statistics
728 .TP
729  /var/spool/mqueue/*
730 temp files
731 .SH SEE ALSO
732 mail(1),
733 syslog(3),
734 aliases(5),
735 mailaddr(7),
736 mail.local(8),
737 rc(8),
738 rmail(8)
739 .PP
740 DARPA 
741 Internet Request For Comments
742 .IR RFC819 ,
743 .IR RFC821 ,
744 .IR RFC822 .
745 .IR "Sendmail Installation and Operation Guide" ,
746 No. 8, SMM.
747 .PP
748 http://www.sendmail.org/
749 .PP
750 US Patent Numbers 6865671, 6986037.
751 .SH HISTORY
752 The
753 .B sendmail
754 command appeared in
755 4.2BSD.
756 .\" $FreeBSD$