home *** CD-ROM | disk | FTP | other *** search
/ InfoMagic Internet Tools 1993 July / Internet Tools.iso / RockRidge / mail / sendmail / sendmail-5.65 / doc / 07.sendmailop / op.me < prev    next >
Encoding:
Text File  |  1989-01-23  |  88.5 KB  |  3,926 lines

  1. .\"
  2. .\" Copyright (c) 1983 Eric P. Allman
  3. .\" Copyright (c) 1988 The Regents of the University of California.
  4. .\" All rights reserved.
  5. .\"
  6. .\" Redistribution and use in source and binary forms are permitted
  7. .\" provided that the above copyright notice and this paragraph are
  8. .\" duplicated in all such forms and that any documentation,
  9. .\" advertising materials, and other materials related to such
  10. .\" distribution and use acknowledge that the software was developed
  11. .\" by the University of California, Berkeley.  The name of the
  12. .\" University may not be used to endorse or promote products derived
  13. .\" from this software without specific prior written permission.
  14. .\" THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR
  15. .\" IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
  16. .\" WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
  17. .\"
  18. .\"    @(#)op.me    5.11 (Berkeley) 1/23/89
  19. .\"
  20. .\" eqn % | troff -me
  21. .\"if n .ls 2
  22. .\".he 'Sendmail Installation and Operation Guide''%'
  23. .\".fo 'Version 5.11''Last Mod 1/23/89'
  24. .eh 'SMM:07-%''Sendmail Installation and Operation Guide'
  25. .oh 'Sendmail Installation and Operation Guide''SMM:07-%'
  26. .nr si 3n
  27. .de $0
  28. .(x
  29. .in \\$3u*3n
  30. .ti -3n
  31. \\$2.  \\$1
  32. .)x
  33. ..
  34. .de $C
  35. .(x
  36. .in 0
  37. \\$1 \\$2.  \\$3
  38. .)x
  39. ..
  40. .+c
  41. .(l C
  42. .sz 16
  43. .b SENDMAIL
  44. .sz 12
  45. .sp
  46. .b "INSTALLATION AND OPERATION GUIDE"
  47. .sz 10
  48. .sp
  49. .r
  50. Eric Allman
  51. Britton-Lee, Inc.
  52. .sp
  53. Version 5.11
  54. .sp
  55. For Sendmail Version 5.61
  56. .)l
  57. .sp 2
  58. .pp
  59. .i Sendmail
  60. implements a general purpose internetwork mail routing facility
  61. under the UNIX*
  62. .(f
  63. *UNIX is a trademark of Bell Laboratories.
  64. .)f
  65. operating system.
  66. It is not tied to any one transport protocol \*-
  67. its function may be likened to a crossbar switch,
  68. relaying messages from one domain into another.
  69. In the process,
  70. it can do a limited amount of message header editing
  71. to put the message into a format that is appropriate
  72. for the receiving domain.
  73. All of this is done under the control of a configuration file.
  74. .pp
  75. Due to the requirements of flexibility
  76. for
  77. .i sendmail ,
  78. the configuration file can seem somewhat unapproachable.
  79. However, there are only a few basic configurations
  80. for most sites,
  81. for which standard configuration files have been supplied.
  82. Most other configurations
  83. can be built by adjusting an existing configuration files
  84. incrementally.
  85. .pp
  86. Although
  87. .i sendmail
  88. is intended to run
  89. without the need for monitoring,
  90. it has a number of features
  91. that may be used to monitor or adjust the operation
  92. under unusual circumstances.
  93. These features are described.
  94. .pp
  95. Section one describes how to do a basic
  96. .i sendmail
  97. installation.
  98. Section two
  99. explains the day-to-day information you should know
  100. to maintain your mail system.
  101. If you have a relatively normal site,
  102. these two sections should contain sufficient information
  103. for you to install
  104. .i sendmail
  105. and keep it happy.
  106. Section three
  107. describes some parameters that may be safely tweaked.
  108. Section four
  109. has information regarding the command line arguments.
  110. Section five
  111. contains the nitty-gritty information about the configuration
  112. file.
  113. This section is for masochists
  114. and people who must write their own configuration file.
  115. The appendixes give a brief
  116. but detailed explanation of a number of features
  117. not described in the rest of the paper.
  118. .pp
  119. The references in this paper are actually found
  120. in the companion paper
  121. .ul
  122. Sendmail \- An Internetwork Mail Router.
  123. This other paper should be read before this manual
  124. to gain a basic understanding
  125. of how the pieces fit together.
  126. .pn 4
  127. .bp
  128. .sh 1 "BASIC INSTALLATION"
  129. .pp
  130. There are two basic steps to installing sendmail.
  131. The hard part is to build the configuration table.
  132. This is a file that sendmail reads when it starts up
  133. that describes the mailers it knows about,
  134. how to parse addresses,
  135. how to rewrite the message header,
  136. and the settings of various options.
  137. Although the configuration table is quite complex,
  138. a configuration can usually be built
  139. by adjusting an existing off-the-shelf configuration.
  140. The second part is actually doing the installation,
  141. i.e., creating the necessary files, etc.
  142. .pp
  143. The remainder of this section will describe the installation of sendmail
  144. assuming you can use one of the existing configurations
  145. and that the standard installation parameters are acceptable.
  146. All pathnames and examples
  147. are given from the root of the
  148. .i sendmail
  149. subtree,
  150. normally
  151. .i /usr/src/usr.lib/sendmail
  152. on 4.3BSD.
  153. .sh 2 "Off-The-Shelf Configurations"
  154. .pp
  155. Configuration files currently in use at Berkeley are in
  156. the directory
  157. .i cf
  158. of the sendmail directory.
  159. This directory contains three subdirectories:
  160. .i cf ,
  161. .i m4 ,
  162. and
  163. .i sitedep .
  164. The directory
  165. .i cf/m4
  166. contains site-independent
  167. .i m4 (1)
  168. include files that have information common to all configuration files,
  169. while
  170. .i cf/sitedep
  171. contains
  172. .i m4 (1)
  173. include files that have site-specific information in them.
  174. These files are used by the master configuration (``.mc'')
  175. in
  176. .i cf/cf
  177. and produce standard configuration files (with
  178. .q .cf
  179. suffix) when run through
  180. .i m4 (1).
  181. .pp
  182. Three off the shelf configurations are supplied
  183. to handle the basic cases:
  184. .np
  185. Internet sites running the nameserver
  186. (or using host tables wherein the fully-qualfied domain
  187. name of each host is listed first)
  188. can use
  189. .i cf/tcpproto.cf .
  190. For simple sites,
  191. you should be able to use this file without modification.
  192. This file is not in
  193. .i m4
  194. format.
  195. .np
  196. UUCP only sites can use
  197. .i cf/uucpproto.cf .
  198. This file is not in
  199. .i m4
  200. format.
  201. .np
  202. A group of machines at a single site
  203. connected by an ethernet (or other networking
  204. that supports TCP/IP)
  205. with (only) one host connected to the outside world
  206. via UUCP
  207. is represented by two configuration files:
  208. .i cf/tcpuucpproto.cf
  209. should be installed on the host with outside connections
  210. and
  211. .i cf/tcpproto.cf
  212. should be installed on all other hosts.
  213. .pp
  214. Some configuration will be needed in each of the
  215. above cases.
  216. Just be sure to correctly fill in the 
  217. .q blanks
  218. as shown in the instructions in the configuration file.
  219. Then install the file as
  220. .i /usr/lib/sendmail.cf .
  221. .pp
  222. If you are running a larger or more complex site, it
  223. is to your advantage to read the
  224. .q README
  225. file in the
  226. .i cf
  227. subdirectory.
  228. This file explains how to use
  229. .i m4 (1)
  230. to automatically create configuration files for
  231. non-standard situations.
  232. .sh 2 "Installation Using the Makefile"
  233. .pp
  234. A makefile exists in the root of the
  235. .i sendmail
  236. directory that will do all of these steps
  237. for a 4.3BSD system.
  238. It may have to be slightly tailored
  239. for use on other systems.
  240. .pp
  241. Before using this makefile, you should create a symbolic link from
  242. .i cf
  243. to the directory containing your configuration files.
  244. You should also have created your configuration file
  245. and left it in the file
  246. .q cf/\fIsystem\fP.cf
  247. where
  248. .i system
  249. is the name of your system
  250. (i.e., what is returned by
  251. .i hostname \|(1)).
  252. If you do not have
  253. .i hostname
  254. you can use the declaration
  255. .q HOST=\fIsystem\fP
  256. on the
  257. .i make \|(1)
  258. command line.
  259. You should also examine the file
  260. .i md/config.m4
  261. and change the
  262. .i m4
  263. macros there to reflect any libraries and compilation flags
  264. you may need.
  265. .pp
  266. The basic installation procedure is to type:
  267. .(b
  268. make
  269. make install
  270. make installcf
  271. .)b
  272. in the root directory of the
  273. .i sendmail
  274. distribution.
  275. This will make all binaries
  276. and install them in the standard places.
  277. The second and third
  278. .i make
  279. commands must be executed as the superuser (root).
  280. .sh 2 "Installation by Hand"
  281. .pp
  282. Along with building a configuration file,
  283. you will have to install the
  284. .i sendmail
  285. startup into your UNIX system.
  286. If you are doing this installation
  287. in conjunction with a regular Berkeley UNIX install,
  288. these steps will already be complete.
  289. Many of these steps will have to be executed as the superuser (root).
  290. .sh 3 "/usr/lib/sendmail"
  291. .pp
  292. The binary for sendmail is located in /usr/lib.
  293. If it becomes necessary to recompile and reinstall the
  294. entire system, the following sequence will do it:
  295. .(b
  296. cd src
  297. make clean
  298. make install
  299. .)b
  300. .sh 3 "/usr/lib/sendmail.cf"
  301. .pp
  302. The configuration file
  303. that you created earlier
  304. should be installed in /usr/lib/sendmail.cf:
  305. .(b
  306. cp cf/\fIsystem\fP.cf /usr/lib/sendmail.cf
  307. .)b
  308. .sh 3 "/usr/ucb/newaliases"
  309. .pp
  310. If you are running delivermail,
  311. it is critical that the
  312. .i newaliases
  313. command be replaced.
  314. This can just be a link to
  315. .i sendmail :
  316. .(b
  317. rm \-f /usr/ucb/newaliases
  318. ln /usr/lib/sendmail /usr/ucb/newaliases
  319. .)b
  320. .sh 3 "/usr/spool/mqueue"
  321. .pp
  322. The directory
  323. .i /usr/spool/mqueue
  324. should be created to hold the mail queue.
  325. This directory should be mode 755
  326. and owned by root.
  327. .sh 3 "/usr/lib/aliases*"
  328. .pp
  329. The system aliases are held in three files.
  330. The file
  331. .q /usr/lib/aliases
  332. is the master copy.
  333. A sample is given in
  334. .q lib/aliases
  335. which includes some aliases which
  336. .i must
  337. be defined:
  338. .(b
  339. cp lib/aliases /usr/lib/aliases
  340. .)b
  341. You should extend this file with any aliases that are apropos to your system.
  342. .pp
  343. Normally
  344. .i sendmail
  345. looks at a version of these files maintained by the
  346. .i dbm \|(3)
  347. routines.
  348. These are stored in
  349. .q /usr/lib/aliases.dir
  350. and
  351. .q /usr/lib/aliases.pag.
  352. These can initially be created as empty files,
  353. but they will have to be initialized promptly.
  354. These should be mode 644:
  355. .(b
  356. cp /dev/null /usr/lib/aliases.dir
  357. cp /dev/null /usr/lib/aliases.pag
  358. chmod 644 /usr/lib/aliases.*
  359. newaliases
  360. .)b
  361. .sh 3 "/usr/lib/sendmail.fc"
  362. .pp
  363. If you intend to install the frozen version of the configuration file
  364. (for quick startup)
  365. you should create the file /usr/lib/sendmail.fc
  366. and initialize it.
  367. This step may be safely skipped.
  368. .(b
  369. cp /dev/null /usr/lib/sendmail.fc
  370. /usr/lib/sendmail \-bz
  371. .)b
  372. .sh 3 "/etc/rc"
  373. .pp
  374. It will be necessary to start up the sendmail daemon when your system reboots.
  375. This daemon performs two functions:
  376. it listens on the SMTP socket for connections
  377. (to receive mail from a remote system)
  378. and it processes the queue periodically
  379. to insure that mail gets delivered when hosts come up.
  380. .pp
  381. Add the following lines to
  382. .q /etc/rc
  383. (or
  384. .q /etc/rc.local
  385. as appropriate)
  386. in the area where it is starting up the daemons:
  387. .(b
  388. if [ \-f /usr/lib/sendmail ]; then
  389.     (cd /usr/spool/mqueue; rm \-f [lnx]f*)
  390.     /usr/lib/sendmail \-bd \-q30m &
  391.     echo \-n ' sendmail' >/dev/console
  392. fi
  393. .)b
  394. The
  395. .q cd
  396. and
  397. .q rm
  398. commands insure that all lock files have been removed;
  399. extraneous lock files may be left around
  400. if the system goes down in the middle of processing a message.
  401. The line that actually invokes
  402. .i sendmail
  403. has two flags:
  404. .q \-bd
  405. causes it to listen on the SMTP port,
  406. and
  407. .q \-q30m
  408. causes it to run the queue every half hour.
  409. .pp
  410. If you are not running a version of UNIX
  411. that supports Berkeley TCP/IP,
  412. do not include the
  413. .b \-bd
  414. flag.
  415. .sh 3 "/usr/lib/sendmail.hf"
  416. .pp
  417. This is the help file used by the SMTP
  418. .b HELP
  419. command.
  420. It should be copied from
  421. .q lib/sendmail.hf :
  422. .(b
  423. cp lib/sendmail.hf /usr/lib
  424. .)b
  425. .sh 3 "/usr/lib/sendmail.st"
  426. .pp
  427. If you wish to collect statistics
  428. about your mail traffic,
  429. you should create the file
  430. .q /usr/lib/sendmail.st :
  431. .(b
  432. cp /dev/null /usr/lib/sendmail.st
  433. chmod 666 /usr/lib/sendmail.st
  434. .)b
  435. This file does not grow.
  436. It is printed with the program
  437. .q aux/mailstats.
  438. .sh 3 "/usr/ucb/newaliases"
  439. .pp
  440. If
  441. .i sendmail
  442. is invoked as
  443. .q newaliases,
  444. it will simulate the
  445. .b \-bi
  446. flag
  447. (i.e., will rebuild the alias database;
  448. see below).
  449. This should be a link to /usr/lib/sendmail.
  450. .sh 3 "/usr/ucb/mailq"
  451. .pp
  452. If
  453. .i sendmail
  454. is invoked as
  455. .q mailq,
  456. it will simulate the
  457. .b \-bp
  458. flag
  459. (i.e.,
  460. .i sendmail
  461. will print the contents of the mail queue;
  462. see below).
  463. This should be a link to /usr/lib/sendmail.
  464. .sh 1 "NORMAL OPERATIONS"
  465. .sh 2 "Quick Configuration Startup"
  466. .pp
  467. A fast version of the configuration file
  468. may be set up by using the
  469. .b \-bz
  470. flag:
  471. .(b
  472. /usr/lib/sendmail \-bz
  473. .)b
  474. This creates the file
  475. .i /usr/lib/sendmail.fc
  476. (\c
  477. .q "frozen configuration" ).
  478. This file is an image of
  479. .i sendmail 's
  480. data space after reading in the configuration file.
  481. If this file exists,
  482. it is used instead of
  483. .i /usr/lib/sendmail.cf
  484. .i sendmail.fc
  485. must be rebuilt manually every time
  486. .i sendmail.cf
  487. is changed.
  488. .pp
  489. The frozen configuration file will be ignored
  490. if a
  491. .b \-C
  492. flag is specified
  493. or if sendmail detects that it is out of date.
  494. However, the heuristics are not strong
  495. so this should not be trusted.
  496. .sh 2 "The System Log"
  497. .pp
  498. The system log is supported by the
  499. .i syslogd \|(8)
  500. program.
  501. .sh 3 "Format"
  502. .pp
  503. Each line in the system log
  504. consists of a timestamp,
  505. the name of the machine that generated it
  506. (for logging from several machines
  507. over the local area network),
  508. the word
  509. .q sendmail: ,
  510. and a message.
  511. .sh 3 "Levels"
  512. .pp
  513. If you have
  514. .i syslogd \|(8)
  515. or an equivalent installed,
  516. you will be able to do logging.
  517. There is a large amount of information that can be logged.
  518. The log is arranged as a succession of levels.
  519. At the lowest level
  520. only extremely strange situations are logged.
  521. At the highest level,
  522. even the most mundane and uninteresting events
  523. are recorded for posterity.
  524. As a convention,
  525. log levels under ten
  526. are considered
  527. .q useful;
  528. log levels above ten
  529. are usually for debugging purposes.
  530. .pp
  531. A complete description of the log levels
  532. is given in section 4.6.
  533. .sh 2 "The Mail Queue"
  534. .pp
  535. The mail queue should be processed transparently.
  536. However, you may find that manual intervention is sometimes necessary.
  537. For example,
  538. if a major host is down for a period of time
  539. the queue may become clogged.
  540. Although sendmail ought to recover gracefully when the host comes up,
  541. you may find performance unacceptably bad in the meantime.
  542. .sh 3 "Printing the queue"
  543. .pp
  544. The contents of the queue can be printed
  545. using the
  546. .i mailq
  547. command
  548. (or by specifying the
  549. .b \-bp
  550. flag to sendmail):
  551. .(b
  552. mailq
  553. .)b
  554. This will produce a listing of the queue id's,
  555. the size of the message,
  556. the date the message entered the queue,
  557. and the sender and recipients.
  558. .sh 3 "Format of queue files"
  559. .pp
  560. All queue files have the form
  561. \fIx\fP\|\fBf\fP\fIAA99999\fP
  562. where
  563. .i AA99999
  564. is the
  565. .i id
  566. for this file
  567. and the
  568. .i x
  569. is a type.
  570. The types are:
  571. .ip d
  572. The data file.
  573. The message body (excluding the header) is kept in this file.
  574. .ip l
  575. The lock file.
  576. If this file exists,
  577. the job is currently being processed,
  578. and a queue run will not process the file.
  579. For that reason,
  580. an extraneous
  581. .b lf
  582. file can cause a job to apparently disappear
  583. (it will not even time out!).
  584. .ip n
  585. This file is created when an id is being created.
  586. It is a separate file to insure that no mail can ever be destroyed
  587. due to a race condition.
  588. It should exist for no more than a few milliseconds
  589. at any given time.
  590. .ip q
  591. The queue control file.
  592. This file contains the information necessary to process the job.
  593. .ip t
  594. A temporary file.
  595. These are an image of the
  596. .b qf
  597. file when it is being rebuilt.
  598. It should be renamed to a
  599. .b qf
  600. file very quickly.
  601. .ip x
  602. A transcript file,
  603. existing during the life of a session
  604. showing everything that happens
  605. during that session.
  606. .pp
  607. The
  608. .b qf
  609. file is structured as a series of lines
  610. each beginning with a code letter.
  611. The lines are as follows:
  612. .ip D
  613. The name of the data file.
  614. There may only be one of these lines.
  615. .ip H
  616. A header definition.
  617. There may be any number of these lines.
  618. The order is important:
  619. they represent the order in the final message.
  620. These use the same syntax
  621. as header definitions in the configuration file.
  622. .ip R
  623. A recipient address.
  624. This will normally be completely aliased,
  625. but is actually realiased when the job is processed.
  626. There will be one line
  627. for each recipient.
  628. .ip S
  629. The sender address.
  630. There may only be one of these lines.
  631. .ip E
  632. An error address.
  633. If any such lines exist,
  634. they represent the addresses that should receive error messages.
  635. .ip T
  636. The job creation time.
  637. This is used to compute when to time out the job.
  638. .ip P
  639. The current message priority.
  640. This is used to order the queue.
  641. Higher numbers mean lower priorities.
  642. The priority changes
  643. as the message sits in the queue.
  644. The initial priority depends on the message class
  645. and the size of the message.
  646. .ip M
  647. A message.
  648. This line is printed by the
  649. .i mailq
  650. command,
  651. and is generally used to store status information.
  652. It can contain any text.
  653. .pp
  654. As an example,
  655. the following is a queue file sent to
  656. .q mckusick@calder
  657. and
  658. .q wnj :
  659. .(b
  660. DdfA13557
  661. Seric
  662. T404261372
  663. P132
  664. Rmckusick@calder
  665. Rwnj
  666. H?D?date: 23-Oct-82 15:49:32-PDT (Sat)
  667. H?F?from: eric (Eric Allman)
  668. H?x?full-name: Eric Allman
  669. Hsubject: this is an example message
  670. Hmessage-id: <8209232249.13557@UCBARPA.BERKELEY.EDU>
  671. Hreceived: by UCBARPA.BERKELEY.EDU (3.227 [10/22/82])
  672.     id A13557; 23-Oct-82 15:49:32-PDT (Sat)
  673. HTo: mckusick@calder, wnj
  674. .)b
  675. This shows the name of the data file,
  676. the person who sent the message,
  677. the submission time
  678. (in seconds since January 1, 1970),
  679. the message priority,
  680. the message class,
  681. the recipients,
  682. and the headers for the message.
  683. .sh 3 "Forcing the queue"
  684. .pp
  685. .i Sendmail
  686. should run the queue automatically
  687. at intervals.
  688. The algorithm is to read and sort the queue,
  689. and then to attempt to process all jobs in order.
  690. When it attempts to run the job,
  691. .i sendmail
  692. first checks to see if the job is locked.
  693. If so, it ignores the job.
  694. .pp
  695. There is no attempt to insure that only one queue processor
  696. exists at any time,
  697. since there is no guarantee that a job cannot take forever
  698. to process.
  699. Due to the locking algorithm,
  700. it is impossible for one job to freeze the queue.
  701. However,
  702. an uncooperative recipient host
  703. or a program recipient
  704. that never returns
  705. can accumulate many processes in your system.
  706. Unfortunately,
  707. there is no way to resolve this
  708. without violating the protocol.
  709. .pp
  710. In some cases,
  711. you may find that a major host going down
  712. for a couple of days
  713. may create a prohibitively large queue.
  714. This will result in
  715. .i sendmail
  716. spending an inordinate amount of time
  717. sorting the queue.
  718. This situation can be fixed by moving the queue to a temporary place
  719. and creating a new queue.
  720. The old queue can be run later when the offending host returns to service.
  721. .pp
  722. To do this,
  723. it is acceptable to move the entire queue directory:
  724. .(b
  725. cd /usr/spool
  726. mv mqueue omqueue; mkdir mqueue; chmod 755 mqueue
  727. .)b
  728. You should then kill the existing daemon
  729. (since it will still be processing in the old queue directory)
  730. and create a new daemon.
  731. .pp
  732. To run the old mail queue,
  733. run the following command:
  734. .(b
  735. /usr/lib/sendmail \-oQ/usr/spool/omqueue \-q
  736. .)b
  737. The
  738. .b \-oQ
  739. flag specifies an alternate queue directory
  740. and the
  741. .b \-q
  742. flag says to just run every job in the queue.
  743. If you have a tendency toward voyeurism,
  744. you can use the
  745. .b \-v
  746. flag to watch what is going on.
  747. .pp
  748. When the queue is finally emptied,
  749. you can remove the directory:
  750. .(b
  751. rmdir /usr/spool/omqueue
  752. .)b
  753. .sh 2 "The Alias Database"
  754. .pp
  755. The alias database exists in two forms.
  756. One is a text form,
  757. maintained in the file
  758. .i /usr/lib/aliases.
  759. The aliases are of the form
  760. .(b
  761. name: name1, name2, ...
  762. .)b
  763. Only local names may be aliased;
  764. e.g.,
  765. .(b
  766. eric@mit-xx: eric@berkeley.EDU
  767. .)b
  768. will not have the desired effect.
  769. Aliases may be continued by starting any continuation lines
  770. with a space or a tab.
  771. Blank lines and lines beginning with a sharp sign
  772. (\c
  773. .q # )
  774. are comments.
  775. .pp
  776. The second form is processed by the
  777. .i dbm \|(3)
  778. library.
  779. This form is in the files
  780. .i /usr/lib/aliases.dir
  781. and
  782. .i /usr/lib/aliases.pag.
  783. This is the form that
  784. .i sendmail
  785. actually uses to resolve aliases.
  786. This technique is used to improve performance.
  787. .sh 3 "Rebuilding the alias database"
  788. .pp
  789. The DBM version of the database
  790. may be rebuilt explicitly by executing the command
  791. .(b
  792. newaliases
  793. .)b
  794. This is equivalent to giving
  795. .i sendmail
  796. the
  797. .b \-bi
  798. flag:
  799. .(b
  800. /usr/lib/sendmail \-bi
  801. .)b
  802. .pp
  803. If the
  804. .q D
  805. option is specified in the configuration,
  806. .i sendmail
  807. will rebuild the alias database automatically
  808. if possible
  809. when it is out of date.
  810. The conditions under which it will do this are:
  811. .np
  812. The DBM version of the database is mode 666.   -or-
  813. .np
  814. .i Sendmail
  815. is running setuid to root.
  816. .lp
  817. Auto-rebuild can be dangerous
  818. on heavily loaded machines
  819. with large alias files;
  820. if it might take more than five minutes
  821. to rebuild the database,
  822. there is a chance that several processes will start the rebuild process
  823. simultaneously.
  824. .sh 3 "Potential problems"
  825. .pp
  826. There are a number of problems that can occur
  827. with the alias database.
  828. They all result from a
  829. .i sendmail
  830. process accessing the DBM version
  831. while it is only partially built.
  832. This can happen under two circumstances:
  833. One process accesses the database
  834. while another process is rebuilding it,
  835. or the process rebuilding the database dies
  836. (due to being killed or a system crash)
  837. before completing the rebuild.
  838. .pp
  839. Sendmail has two techniques to try to relieve these problems.
  840. First, it ignores interrupts while rebuilding the database;
  841. this avoids the problem of someone aborting the process
  842. leaving a partially rebuilt database.
  843. Second,
  844. at the end of the rebuild
  845. it adds an alias of the form
  846. .(b
  847. @: @
  848. .)b
  849. (which is not normally legal).
  850. Before sendmail will access the database,
  851. it checks to insure that this entry exists\**.
  852. .(f
  853. \**The
  854. .q a
  855. option is required in the configuration
  856. for this action to occur.
  857. This should normally be specified
  858. unless you are running
  859. .i delivermail
  860. in parallel with
  861. .i sendmail.
  862. .)f
  863. .i Sendmail
  864. will wait for this entry to appear,
  865. at which point it will force a rebuild itself\**.
  866. .(f
  867. \**Note:
  868. the
  869. .q D
  870. option must be specified in the configuration file
  871. for this operation to occur.
  872. If the
  873. .q D
  874. option is not specified,
  875. a warning message is generated and
  876. .i sendmail
  877. continues.
  878. .)f
  879. .sh 3 "List owners"
  880. .pp
  881. If an error occurs on sending to a certain address,
  882. say
  883. .q \fIx\fP ,
  884. .i sendmail
  885. will look for an alias
  886. of the form
  887. .q owner-\fIx\fP
  888. to receive the errors.
  889. This is typically useful
  890. for a mailing list
  891. where the submitter of the list
  892. has no control over the maintenance of the list itself;
  893. in this case the list maintainer would be the owner of the list.
  894. For example:
  895. .(b
  896. unix-wizards: eric@ucbarpa, wnj@monet, nosuchuser,
  897.     sam@matisse
  898. owner-unix-wizards: eric@ucbarpa
  899. .)b
  900. would cause
  901. .q eric@ucbarpa
  902. to get the error that will occur
  903. when someone sends to
  904. unix-wizards
  905. due to the inclusion of
  906. .q nosuchuser
  907. on the list.
  908. .sh 2 "Per-User Forwarding (.forward Files)"
  909. .pp
  910. As an alternative to the alias database,
  911. any user may put a file with the name
  912. .q .forward
  913. in his or her home directory.
  914. If this file exists,
  915. .i sendmail
  916. redirects mail for that user
  917. to the list of addresses listed in the .forward file.
  918. For example, if the home directory for user
  919. .q mckusick
  920. has a .forward file with contents:
  921. .(b
  922. mckusick@ernie
  923. kirk@calder
  924. .)b
  925. then any mail arriving for
  926. .q mckusick
  927. will be redirected to the specified accounts.
  928. .sh 2 "Special Header Lines"
  929. .pp
  930. Several header lines have special interpretations
  931. defined by the configuration file.
  932. Others have interpretations built into
  933. .i sendmail
  934. that cannot be changed without changing the code.
  935. These builtins are described here.
  936. .sh 3 "Return-Receipt-To:"
  937. .pp
  938. If this header is sent,
  939. a message will be sent to any specified addresses
  940. when the final delivery is complete,
  941. that is,
  942. when successfully delivered to a mailer with the
  943. .b l
  944. flag (local delivery) set in the mailer descriptor.
  945. .sh 3 "Errors-To:"
  946. .pp
  947. If errors occur anywhere during processing,
  948. this header will cause error messages to go to
  949. the listed addresses
  950. rather than to the sender.
  951. This is intended for mailing lists.
  952. .sh 3 "Apparently-To:"
  953. .pp
  954. If a message comes in with no recipients listed in the message
  955. (in a To:, Cc:, or Bcc: line)
  956. then
  957. .i sendmail
  958. will add an
  959. .q "Apparently-To:"
  960. header line for any recipients it is aware of.
  961. This is not put in as a standard recipient line
  962. to warn any recipients that the list is not complete.
  963. .pp
  964. At least one recipient line is required under RFC 822.
  965. .sh 1 "ARGUMENTS"
  966. .pp
  967. The complete list of arguments to
  968. .i sendmail
  969. is described in detail in Appendix A.
  970. Some important arguments are described here.
  971. .sh 2 "Queue Interval"
  972. .pp
  973. The amount of time between forking a process
  974. to run through the queue
  975. is defined by the
  976. .b \-q
  977. flag.
  978. If you run in mode
  979. .b f
  980. or
  981. .b a
  982. this can be relatively large,
  983. since it will only be relevant
  984. when a host that was down comes back up.
  985. If you run in
  986. .b q
  987. mode
  988. it should be relatively short,
  989. since it defines the maximum amount of time that a message
  990. may sit in the queue.
  991. .sh 2 "Daemon Mode"
  992. .pp
  993. If you allow incoming mail over an IPC connection,
  994. you should have a daemon running.
  995. This should be set by your
  996. .i /etc/rc
  997. file using the
  998. .b \-bd
  999. flag.
  1000. The
  1001. .b \-bd
  1002. flag and the
  1003. .b \-q
  1004. flag may be combined in one call:
  1005. .(b
  1006. /usr/lib/sendmail \-bd \-q30m
  1007. .)b
  1008. .sh 2 "Forcing the Queue"
  1009. .pp
  1010. In some cases you may find that the queue has gotten clogged for some reason.
  1011. You can force a queue run
  1012. using the
  1013. .b \-q
  1014. flag (with no value).
  1015. It is entertaining to use the
  1016. .b \-v
  1017. flag (verbose)
  1018. when this is done to watch what happens:
  1019. .(b
  1020. /usr/lib/sendmail \-q \-v
  1021. .)b
  1022. .sh 2 "Debugging"
  1023. .pp
  1024. There are a fairly large number of debug flags
  1025. built into
  1026. .i sendmail .
  1027. Each debug flag has a number and a level,
  1028. where higher levels means to print out more information.
  1029. The convention is that levels greater than nine are
  1030. .q absurd,
  1031. i.e.,
  1032. they print out so much information that you wouldn't normally
  1033. want to see them except for debugging that particular piece of code.
  1034. Debug flags are set using the
  1035. .b \-d
  1036. option;
  1037. the syntax is:
  1038. .(b
  1039. .ta \w'debug-option  'u
  1040. debug-flag:    \fB\-d\fP debug-list
  1041. debug-list:    debug-option [ , debug-option ]
  1042. debug-option:    debug-range [ . debug-level ]
  1043. debug-range:    integer | integer \- integer
  1044. debug-level:    integer
  1045. .)b
  1046. where spaces are for reading ease only.
  1047. For example,
  1048. .(b
  1049. \-d12    Set flag 12 to level 1
  1050. \-d12.3    Set flag 12 to level 3
  1051. \-d3-17    Set flags 3 through 17 to level 1
  1052. \-d3-17.4    Set flags 3 through 17 to level 4
  1053. .)b
  1054. For a complete list of the available debug flags
  1055. you will have to look at the code
  1056. (they are too dynamic to keep this documentation up to date).
  1057. .sh 2 "Trying a Different Configuration File"
  1058. .pp
  1059. An alternative configuration file
  1060. can be specified using the
  1061. .b \-C
  1062. flag; for example,
  1063. .(b
  1064. /usr/lib/sendmail \-Ctest.cf
  1065. .)b
  1066. uses the configuration file
  1067. .i test.cf
  1068. instead of the default
  1069. .i /usr/lib/sendmail.cf.
  1070. If the
  1071. .b \-C
  1072. flag has no value
  1073. it defaults to
  1074. .i sendmail.cf
  1075. in the current directory.
  1076. .sh 2 "Changing the Values of Options"
  1077. .pp
  1078. Options can be overridden using the
  1079. .b \-o
  1080. flag.
  1081. For example,
  1082. .(b
  1083. /usr/lib/sendmail \-oT2m
  1084. .)b
  1085. sets the
  1086. .b T
  1087. (timeout) option to two minutes
  1088. for this run only.
  1089. .sh 1 "TUNING"
  1090. .pp
  1091. There are a number of configuration parameters
  1092. you may want to change,
  1093. depending on the requirements of your site.
  1094. Most of these are set
  1095. using an option in the configuration file.
  1096. For example,
  1097. the line
  1098. .q OT3d
  1099. sets option
  1100. .q T
  1101. to the value
  1102. .q 3d
  1103. (three days).
  1104. .pp
  1105. Most of these options default appropriately for most sites.
  1106. However,
  1107. sites having very high mail loads may find they need to tune them
  1108. as appropriate for their mail load.
  1109. In particular,
  1110. sites experiencing a large number of small messages,
  1111. many of which are delivered to many recipients,
  1112. may find that they need to adjust the parameters
  1113. dealing with queue priorities.
  1114. .sh 2 "Timeouts"
  1115. .pp
  1116. All time intervals are set
  1117. using a scaled syntax.
  1118. For example,
  1119. .q 10m
  1120. represents ten minutes, whereas
  1121. .q 2h30m
  1122. represents two and a half hours.
  1123. The full set of scales is:
  1124. .(b
  1125. .ta 4n
  1126. s    seconds
  1127. m    minutes
  1128. h    hours
  1129. d    days
  1130. w    weeks
  1131. .)b
  1132. .sh 3 "Queue interval"
  1133. .pp
  1134. The argument to the
  1135. .b \-q
  1136. flag
  1137. specifies how often a subdaemon will run the queue.
  1138. This is typically set to between fifteen minutes
  1139. and one hour.
  1140. .sh 3 "Read timeouts"
  1141. .pp
  1142. It is possible to time out when reading the standard input
  1143. or when reading from a remote SMTP server.
  1144. Technically,
  1145. this is not acceptable within the published protocols.
  1146. However,
  1147. it might be appropriate to set it to something large
  1148. in certain environments
  1149. (such as an hour).
  1150. This will reduce the chance of large numbers of idle daemons
  1151. piling up on your system.
  1152. This timeout is set using the
  1153. .b r
  1154. option in the configuration file.
  1155. .sh 3 "Message timeouts"
  1156. .pp
  1157. After sitting in the queue for a few days,
  1158. a message will time out.
  1159. This is to insure that at least the sender is aware
  1160. of the inability to send a message.
  1161. The timeout is typically set to three days.
  1162. This timeout is set using the
  1163. .b T
  1164. option in the configuration file.
  1165. .pp
  1166. The time of submission is set in the queue,
  1167. rather than the amount of time left until timeout.
  1168. As a result, you can flush messages that have been hanging
  1169. for a short period
  1170. by running the queue
  1171. with a short message timeout.
  1172. For example,
  1173. .(b
  1174. /usr/lib/sendmail \-oT1d \-q
  1175. .)b
  1176. will run the queue
  1177. and flush anything that is one day old.
  1178. .sh 2 "Forking During Queue Runs"
  1179. .pp
  1180. By setting the
  1181. .b Y
  1182. option,
  1183. .i sendmail
  1184. will fork before each individual message
  1185. while running the queue.
  1186. This will prevent
  1187. .i sendmail
  1188. from consuming large amounts of memory,
  1189. so it may be useful in memory-poor environments.
  1190. However, if the
  1191. .b Y
  1192. option is not set,
  1193. .i sendmail
  1194. will keep track of hosts that are down during a queue run,
  1195. which can improve performance dramatically.
  1196. .sh 2 "Queue Priorities"
  1197. .pp
  1198. Every message is assigned a priority when it is first instantiated,
  1199. consisting of the message size (in bytes)
  1200. offset by the message class times the
  1201. .q "work class factor"
  1202. and the number of recipients times the
  1203. .q "work recipient factor."
  1204. The priority plus the creation time of the message
  1205. (in seconds since January 1, 1970)
  1206. are used to order the queue.
  1207. Higher numbers for the priority mean that the message will be processed later
  1208. when running the queue.
  1209. .pp
  1210. The message size is included so that large messages are penalized
  1211. relative to small messages.
  1212. The message class allows users to send
  1213. .q "high priority"
  1214. messages by including a
  1215. .q Precedence:
  1216. field in their message;
  1217. the value of this field is looked up in the
  1218. .b P
  1219. lines of the configuration file.
  1220. Since the number of recipients affects the amount of load a message presents
  1221. to the system,
  1222. this is also included into the priority.
  1223. .pp
  1224. The recipient and class factors
  1225. can be set in the configuration file using the
  1226. .b y
  1227. and
  1228. .b z
  1229. options respectively.
  1230. They default to 1000 (for the recipient factor)
  1231. and 1800
  1232. (for the class factor).
  1233. The initial priority is:
  1234. .(b
  1235. pri = size \- (class * z) + (nrcpt * y)
  1236. .)b
  1237. (Remember, higher values for this parameter actually mean
  1238. that the job will be treated with lower priority.)
  1239. .pp
  1240. The priority of a job can also be adjusted each time it is processed
  1241. (that is, each time an attempt is made to deliver it)
  1242. using the
  1243. .q "work time factor,"
  1244. set by the
  1245. .b Z
  1246. option.
  1247. This is added to the priority,
  1248. so it normally decreases the precedence of the job,
  1249. on the grounds that jobs that have failed many times
  1250. will tend to fail again in the future.
  1251. .sh 2 "Load Limiting"
  1252. .pp
  1253. .i Sendmail
  1254. can be asked to queue (but not deliver)
  1255. mail if the system load average gets too high
  1256. using the
  1257. .b x
  1258. option.
  1259. When the load average exceeds the value of the
  1260. .b x
  1261. option,
  1262. the delivery mode is set to
  1263. .b q
  1264. (queue only)
  1265. if the
  1266. .i "Queue Factor"
  1267. (\c
  1268. .b q
  1269. option)
  1270. divided by the difference in the current load average and the
  1271. .b x
  1272. option
  1273. plus one
  1274. exceeds the priority of the message \(em
  1275. that is, the message is queued iff:
  1276. .EQ
  1277. pri > QF over { LA - x + 1 }
  1278. .EN
  1279. The
  1280. .b q
  1281. option defaults to 10000,
  1282. so each point of load average is worth 10000
  1283. priority points
  1284. (as described above, that is, bytes + seconds + offsets).
  1285. .pp
  1286. For drastic cases,
  1287. the
  1288. .b X
  1289. option defines a load average at which sendmail will refuse
  1290. to accept network connections.
  1291. Locally generated mail
  1292. (including incoming UUCP mail)
  1293. is still accepted.
  1294. .sh 2 "Delivery Mode"
  1295. .pp
  1296. There are a number of delivery modes that
  1297. .i sendmail
  1298. can operate in,
  1299. set by the
  1300. .q d
  1301. configuration option.
  1302. These modes
  1303. specify how quickly mail will be delivered.
  1304. Legal modes are:
  1305. .(b
  1306. .ta 4n
  1307. i    deliver interactively (synchronously)
  1308. b    deliver in background (asynchronously)
  1309. q    queue only (don't deliver)
  1310. .)b
  1311. There are tradeoffs.
  1312. Mode
  1313. .q i
  1314. passes the maximum amount of information to the sender,
  1315. but is hardly ever necessary.
  1316. Mode
  1317. .q q
  1318. puts the minimum load on your machine,
  1319. but means that delivery may be delayed for up to the queue interval.
  1320. Mode
  1321. .q b
  1322. is probably a good compromise.
  1323. However, this mode can cause large numbers of processes
  1324. if you have a mailer that takes a long time to deliver a message.
  1325. .sh 2 "Log Level"
  1326. .pp
  1327. The level of logging can be set for sendmail.
  1328. The default using a standard configuration table is level 9.
  1329. The levels are as follows:
  1330. .ip 0
  1331. No logging.
  1332. .ip 1
  1333. Major problems only.
  1334. .ip 2
  1335. Message collections and failed deliveries.
  1336. .ip 3
  1337. Successful deliveries.
  1338. .ip 4
  1339. Messages being deferred
  1340. (due to a host being down, etc.).
  1341. .ip 5
  1342. Normal message queueups.
  1343. .ip 6
  1344. Unusual but benign incidents,
  1345. e.g.,
  1346. trying to process a locked queue file.
  1347. .ip 9
  1348. Log internal queue id to external message id mappings.
  1349. This can be useful for tracing a message
  1350. as it travels between several hosts.
  1351. .ip 12
  1352. Several messages that are basically only of interest
  1353. when debugging.
  1354. .ip 16
  1355. Verbose information regarding the queue.
  1356. .sh 2 "File Modes"
  1357. .pp
  1358. There are a number of files
  1359. that may have a number of modes.
  1360. The modes depend on what functionality you want
  1361. and the level of security you require.
  1362. .sh 3 "To suid or not to suid?"
  1363. .pp
  1364. .i Sendmail
  1365. can safely be made
  1366. setuid to root.
  1367. At the point where it is about to
  1368. .i exec \|(2)
  1369. a mailer,
  1370. it checks to see if the userid is zero;
  1371. if so,
  1372. it resets the userid and groupid to a default
  1373. (set by the
  1374. .b u
  1375. and
  1376. .b g
  1377. options).
  1378. (This can be overridden
  1379. by setting the
  1380. .b S
  1381. flag to the mailer
  1382. for mailers that are trusted
  1383. and must be called as root.)
  1384. However,
  1385. this will cause mail processing
  1386. to be accounted
  1387. (using
  1388. .i sa \|(8))
  1389. to root
  1390. rather than to the user sending the mail.
  1391. .sh 3 "Should my alias database be writable?"
  1392. .pp
  1393. At Berkeley
  1394. we have the alias database
  1395. (/usr/lib/aliases*)
  1396. mode 644.
  1397. While this is not as flexible as if the database
  1398. were more 666, it avoids potential security problems
  1399. with a globally writable database.
  1400. .pp
  1401. The database that
  1402. .i sendmail
  1403. actually used
  1404. is represented by the two files
  1405. .i aliases.dir
  1406. and
  1407. .i aliases.pag
  1408. (both in /usr/lib).
  1409. The mode on these files should match the mode
  1410. on /usr/lib/aliases.
  1411. If
  1412. .i aliases
  1413. is writable
  1414. and the
  1415. DBM
  1416. files
  1417. (\c
  1418. .i aliases.dir
  1419. and
  1420. .i aliases.pag )
  1421. are not,
  1422. users will be unable to reflect their desired changes
  1423. through to the actual database.
  1424. However,
  1425. if
  1426. .i aliases
  1427. is read-only
  1428. and the DBM files are writable,
  1429. a slightly sophisticated user
  1430. can arrange to steal mail anyway.
  1431. .pp
  1432. If your DBM files are not writable by the world
  1433. or you do not have auto-rebuild enabled
  1434. (with the
  1435. .q D
  1436. option),
  1437. then you must be careful to reconstruct the alias database
  1438. each time you change the text version:
  1439. .(b
  1440. newaliases
  1441. .)b
  1442. If this step is ignored or forgotten
  1443. any intended changes will also be ignored or forgotten.
  1444. .sh 1 "THE WHOLE SCOOP ON THE CONFIGURATION FILE"
  1445. .pp
  1446. This section describes the configuration file
  1447. in detail,
  1448. including hints on how to write one of your own
  1449. if you have to.
  1450. .pp
  1451. There is one point that should be made clear immediately:
  1452. the syntax of the configuration file
  1453. is designed to be reasonably easy to parse,
  1454. since this is done every time
  1455. .i sendmail
  1456. starts up,
  1457. rather than easy for a human to read or write.
  1458. On the
  1459. .q "future project"
  1460. list is a
  1461. configuration-file compiler.
  1462. .pp
  1463. An overview of the configuration file
  1464. is given first,
  1465. followed by details of the semantics.
  1466. .sh 2 "The Syntax"
  1467. .pp
  1468. The configuration file is organized as a series of lines,
  1469. each of which begins with a single character
  1470. defining the semantics for the rest of the line.
  1471. Lines beginning with a space or a tab
  1472. are continuation lines
  1473. (although the semantics are not well defined in many places).
  1474. Blank lines and lines beginning with a sharp symbol
  1475. (`#')
  1476. are comments.
  1477. .sh 3 "R and S \*- rewriting rules"
  1478. .pp
  1479. The core of address parsing
  1480. are the rewriting rules.
  1481. These are an ordered production system.
  1482. .i Sendmail
  1483. scans through the set of rewriting rules
  1484. looking for a match on the left hand side
  1485. (LHS)
  1486. of the rule.
  1487. When a rule matches,
  1488. the address is replaced by the right hand side
  1489. (RHS)
  1490. of the rule.
  1491. .pp
  1492. There are several sets of rewriting rules.
  1493. Some of the rewriting sets are used internally
  1494. and must have specific semantics.
  1495. Other rewriting sets
  1496. do not have specifically assigned semantics,
  1497. and may be referenced by the mailer definitions
  1498. or by other rewriting sets.
  1499. .pp
  1500. The syntax of these two commands are:
  1501. .(b F
  1502. .b S \c
  1503. .i n
  1504. .)b
  1505. Sets the current ruleset being collected to
  1506. .i n .
  1507. If you begin a ruleset more than once
  1508. it deletes the old definition.
  1509. .(b F
  1510. .b R \c
  1511. .i lhs
  1512. .i rhs
  1513. .i comments
  1514. .)b
  1515. The
  1516. fields must be separated
  1517. by at least one tab character;
  1518. there may be embedded spaces
  1519. in the fields.
  1520. The
  1521. .i lhs
  1522. is a pattern that is applied to the input.
  1523. If it matches,
  1524. the input is rewritten to the
  1525. .i rhs .
  1526. The
  1527. .i comments
  1528. are ignored.
  1529. .sh 3 "D \*- define macro"
  1530. .pp
  1531. Macros are named with a single character.
  1532. These may be selected from the entire ASCII set,
  1533. but user-defined macros
  1534. should be selected from the set of upper case letters only.
  1535. Lower case letters
  1536. and special symbols
  1537. are used internally.
  1538. .pp
  1539. The syntax for macro definitions is:
  1540. .(b F
  1541. .b D \c
  1542. .i x\|val
  1543. .)b
  1544. where
  1545. .i x
  1546. is the name of the macro
  1547. and
  1548. .i val
  1549. is the value it should have.
  1550. Macros can be interpolated in most places using the escape sequence
  1551. .b $ \c
  1552. .i x .
  1553. .sh 3 "C and F \*- define classes"
  1554. .pp
  1555. Classes of words may be defined
  1556. to match on the left hand side of rewriting rules,
  1557. where a
  1558. .q word
  1559. is a sequence of characters that do not contain characters
  1560. in the $o macro.
  1561. For example
  1562. a class of all local names for this site
  1563. might be created
  1564. so that attempts to send to oneself
  1565. can be eliminated.
  1566. These can either be defined directly in the configuration file
  1567. or read in from another file.
  1568. Classes may be given names
  1569. from the set of upper case letters.
  1570. Lower case letters and special characters
  1571. are reserved for system use.
  1572. .pp
  1573. The syntax is:
  1574. .(b F
  1575. .b C \c
  1576. .i c\|word1
  1577. .i word2...
  1578. .br
  1579. .b F \c
  1580. .i c\|file
  1581. .)b
  1582. The first form defines the class
  1583. .i c
  1584. to match any of the named words.
  1585. It is permissible to split them among multiple lines;
  1586. for example, the two forms:
  1587. .(b
  1588. CHmonet ucbmonet
  1589. .)b
  1590. and
  1591. .(b
  1592. CHmonet
  1593. CHucbmonet
  1594. .)b
  1595. are equivalent.
  1596. The second form
  1597. reads the elements of the class
  1598. .i c
  1599. from the named
  1600. .i file .
  1601. .sh 3 "M \*- define mailer"
  1602. .pp
  1603. Programs and interfaces to mailers
  1604. are defined in this line.
  1605. The format is:
  1606. .(b F
  1607. .b M \c
  1608. .i name ,
  1609. {\c
  1610. .i field =\c
  1611. .i value \|}*
  1612. .)b
  1613. where
  1614. .i name
  1615. is the name of the mailer
  1616. (used internally only)
  1617. and the
  1618. .q field=name
  1619. pairs define attributes of the mailer.
  1620. Fields are:
  1621. .(b
  1622. .ta 1i
  1623. Path    The pathname of the mailer
  1624. Flags    Special flags for this mailer
  1625. Sender    A rewriting set for sender addresses
  1626. Recipient    A rewriting set for recipient addresses
  1627. Argv    An argument vector to pass to this mailer
  1628. Eol    The end-of-line string for this mailer
  1629. Maxsize    The maximum message length to this mailer
  1630. .)b
  1631. Only the first character of the field name is checked.
  1632. .sh 3 "H \*- define header"
  1633. .pp
  1634. The format of the header lines that sendmail inserts into the message
  1635. are defined by the
  1636. .b H
  1637. line.
  1638. The syntax of this line is:
  1639. .(b F
  1640. .b H [\c
  1641. .b ? \c
  1642. .i mflags \c
  1643. .b ? ]\c
  1644. .i hname \c
  1645. .b :
  1646. .i htemplate
  1647. .)b
  1648. Continuation lines in this spec
  1649. are reflected directly into the outgoing message.
  1650. The
  1651. .i htemplate
  1652. is macro expanded before insertion into the message.
  1653. If the
  1654. .i mflags
  1655. (surrounded by question marks)
  1656. are specified,
  1657. at least one of the specified flags
  1658. must be stated in the mailer definition
  1659. for this header to be automatically output.
  1660. If one of these headers is in the input
  1661. it is reflected to the output
  1662. regardless of these flags.
  1663. .pp
  1664. Some headers have special semantics
  1665. that will be described below.
  1666. .sh 3 "O \*- set option"
  1667. .pp
  1668. There are a number of
  1669. .q random
  1670. options that
  1671. can be set from a configuration file.
  1672. Options are represented by single characters.
  1673. The syntax of this line is:
  1674. .(b F
  1675. .b O \c
  1676. .i o\|value
  1677. .)b
  1678. This sets option
  1679. .i o
  1680. to be
  1681. .i value .
  1682. Depending on the option,
  1683. .i value
  1684. may be a string, an integer,
  1685. a boolean
  1686. (with legal values
  1687. .q t ,
  1688. .q T ,
  1689. .q f ,
  1690. or
  1691. .q F ;
  1692. the default is TRUE),
  1693. or
  1694. a time interval.
  1695. .sh 3 "T \*- define trusted users"
  1696. .pp
  1697. Trusted users
  1698. are those users who are permitted
  1699. to override the sender address
  1700. using the
  1701. .b \-f
  1702. flag.
  1703. These typically are
  1704. .q root,
  1705. .q uucp,
  1706. and
  1707. .q network,
  1708. but on some users it may be convenient
  1709. to extend this list to include other users,
  1710. perhaps to support
  1711. a separate
  1712. UUCP
  1713. login for each host.
  1714. The syntax of this line is:
  1715. .(b F
  1716. .b T \c
  1717. .i user1
  1718. .i user2 ...
  1719. .)b
  1720. There may be more than one of these lines.
  1721. .sh 3 "P \*- precedence definitions"
  1722. .pp
  1723. Values for the
  1724. .q "Precedence:"
  1725. field may be defined using the
  1726. .b P
  1727. control line.
  1728. The syntax of this field is:
  1729. .(b
  1730. \fBP\fP\fIname\fP\fB=\fP\fInum\fP
  1731. .)b
  1732. When the
  1733. .i name
  1734. is found in a
  1735. .q Precedence:
  1736. field,
  1737. the message class is set to
  1738. .i num .
  1739. Higher numbers mean higher precedence.
  1740. Numbers less than zero
  1741. have the special property
  1742. that error messages will not be returned.
  1743. The default precedence is zero.
  1744. For example,
  1745. our list of precedences is:
  1746. .(b
  1747. Pfirst-class=0
  1748. Pspecial-delivery=100
  1749. Pjunk=\-100
  1750. .)b
  1751. .sh 2 "The Semantics"
  1752. .pp
  1753. This section describes the semantics of the configuration file.
  1754. .sh 3 "Special macros, conditionals"
  1755. .pp
  1756. Macros are interpolated
  1757. using the construct
  1758. .b $ \c
  1759. .i x ,
  1760. where
  1761. .i x
  1762. is the name of the macro to be interpolated.
  1763. In particular,
  1764. lower case letters are reserved to have
  1765. special semantics,
  1766. used to pass information in or out of sendmail,
  1767. and some special characters are reserved to
  1768. provide conditionals, etc.
  1769. .pp
  1770. Conditionals can be specified using the syntax:
  1771. .(b
  1772. $?x text1 $| text2 $.
  1773. .)b
  1774. This interpolates
  1775. .i text1
  1776. if the macro
  1777. .b $x
  1778. is set,
  1779. and
  1780. .i text2
  1781. otherwise.
  1782. The
  1783. .q else
  1784. (\c
  1785. .b $| )
  1786. clause may be omitted.
  1787. .pp
  1788. The following macros
  1789. .i must
  1790. be defined to transmit information into
  1791. .i sendmail:
  1792. .(b
  1793. .ta 4n
  1794. e    The SMTP entry message
  1795. j    The \*(lqofficial\*(rq domain name for this site
  1796. l    The format of the UNIX from line
  1797. n    The name of the daemon (for error messages)
  1798. o    The set of "operators" in addresses
  1799. q    default format of sender address
  1800. .)b
  1801. The
  1802. .b $e
  1803. macro is printed out when SMTP starts up.
  1804. The first word must be the
  1805. .b $j
  1806. macro.
  1807. The
  1808. .b $j
  1809. macro
  1810. should be in RFC821 format.
  1811. The
  1812. .b $l
  1813. and
  1814. .b $n
  1815. macros can be considered constants
  1816. except under terribly unusual circumstances.
  1817. The
  1818. .b $o
  1819. macro consists of a list of characters
  1820. which will be considered tokens
  1821. and which will separate tokens
  1822. when doing parsing.
  1823. For example, if
  1824. .q @
  1825. were in the
  1826. .b $o
  1827. macro, then the input
  1828. .q a@b
  1829. would be scanned as three tokens:
  1830. .q a,
  1831. .q @,
  1832. and
  1833. .q b.
  1834. Finally, the
  1835. .b $q
  1836. macro specifies how an address should appear in a message
  1837. when it is defaulted.
  1838. For example, on our system these definitions are:
  1839. .(b
  1840. De$j Sendmail $v ready at $b
  1841. DnMAILER-DAEMON
  1842. DlFrom $g  $d
  1843. Do.:%@!^=/
  1844. Dq$g$?x ($x)$.
  1845. Dj$H.$D
  1846. .)b
  1847. An acceptable alternative for the
  1848. .b $q
  1849. macro is
  1850. .q "$?x$x $.<$g>" .
  1851. These correspond to the following two formats:
  1852. .(b
  1853. eric@Berkeley (Eric Allman)
  1854. Eric Allman <eric@Berkeley>
  1855. .)b
  1856. .pp
  1857. Some macros are defined by
  1858. .i sendmail
  1859. for interpolation into argv's for mailers
  1860. or for other contexts.
  1861. These macros are:
  1862. .(b
  1863. a    The origination date in RFC 822 format
  1864. b    The current date in RFC 822 format
  1865. c    The hop count
  1866. d    The date in UNIX (ctime) format
  1867. f    The sender (from) address
  1868. g    The sender address relative to the recipient
  1869. h    The recipient host
  1870. i    The queue id
  1871. p    Sendmail's pid
  1872. r    Protocol used
  1873. s    Sender's host name
  1874. t    A numeric representation of the current time
  1875. u    The recipient user
  1876. v    The version number of sendmail
  1877. w    The hostname of this site
  1878. x    The full name of the sender
  1879. z    The home directory of the recipient
  1880. .)b
  1881. .pp
  1882. There are three types of dates that can be used.
  1883. The
  1884. .b $a
  1885. and
  1886. .b $b
  1887. macros are in RFC 822 format;
  1888. .b $a
  1889. is the time as extracted from the
  1890. .q Date:
  1891. line of the message
  1892. (if there was one),
  1893. and
  1894. .b $b
  1895. is the current date and time
  1896. (used for postmarks).
  1897. If no
  1898. .q Date:
  1899. line is found in the incoming message,
  1900. .b $a
  1901. is set to the current time also.
  1902. The
  1903. .b $d
  1904. macro is equivalent to the
  1905. .b $a
  1906. macro in UNIX
  1907. (ctime)
  1908. format.
  1909. .pp
  1910. The
  1911. .b $f
  1912. macro is the id of the sender
  1913. as originally determined;
  1914. when mailing to a specific host
  1915. the
  1916. .b $g
  1917. macro is set to the address of the sender
  1918. .ul
  1919. relative to the recipient.
  1920. For example,
  1921. if I send to
  1922. .q bollard@matisse
  1923. from the machine
  1924. .q ucbarpa
  1925. the
  1926. .b $f
  1927. macro will be
  1928. .q eric
  1929. and the
  1930. .b $g
  1931. macro will be
  1932. .q eric@ucbarpa.
  1933. .pp
  1934. The
  1935. .b $x
  1936. macro is set to the full name of the sender.
  1937. This can be determined in several ways.
  1938. It can be passed as flag to
  1939. .i sendmail.
  1940. The second choice is the value of the
  1941. .q Full-name:
  1942. line in the header if it exists,
  1943. and the third choice is the comment field
  1944. of a
  1945. .q From:
  1946. line.
  1947. If all of these fail,
  1948. and if the message is being originated locally,
  1949. the full name is looked up in the
  1950. .i /etc/passwd
  1951. file.
  1952. .pp
  1953. When sending,
  1954. the
  1955. .b $h ,
  1956. .b $u ,
  1957. and
  1958. .b $z
  1959. macros get set to the host, user, and home directory
  1960. (if local)
  1961. of the recipient.
  1962. The first two are set from the
  1963. .b $@
  1964. and
  1965. .b $:
  1966. part of the rewriting rules, respectively.
  1967. .pp
  1968. The
  1969. .b $p
  1970. and
  1971. .b $t
  1972. macros are used to create unique strings
  1973. (e.g., for the
  1974. .q Message-Id:
  1975. field).
  1976. The
  1977. .b $i
  1978. macro is set to the queue id on this host;
  1979. if put into the timestamp line
  1980. it can be extremely useful for tracking messages.
  1981. The
  1982. .b $v
  1983. macro is set to be the version number of
  1984. .i sendmail ;
  1985. this is normally put in timestamps
  1986. and has been proven extremely useful for debugging.
  1987. The
  1988. .b $w
  1989. macro is set to the name of this host
  1990. if it can be determined.
  1991. The
  1992. .b $c
  1993. field is set to the
  1994. .q "hop count,"
  1995. i.e., the number of times this message has been processed.
  1996. This can be determined
  1997. by the
  1998. .b \-h
  1999. flag on the command line
  2000. or by counting the timestamps in the message.
  2001. .pp
  2002. The
  2003. .b $r
  2004. and
  2005. .b $s
  2006. fields are set to the protocol used to communicate with sendmail
  2007. and the sending hostname;
  2008. these are not supported in the current version.
  2009. .sh 3 "Special classes"
  2010. .pp
  2011. The class
  2012. .b $=w
  2013. is set to be the set of all names
  2014. this host is known by.
  2015. This can be used to match local hostnames.
  2016. .sh 3 "The left hand side"
  2017. .pp
  2018. The left hand side of rewriting rules contains a pattern.
  2019. Normal words are simply matched directly.
  2020. Metasyntax is introduced using a dollar sign.
  2021. The metasymbols are:
  2022. .(b
  2023. .ta \w'\fB$=\fP\fIx\fP  'u
  2024. \fB$*\fP    Match zero or more tokens
  2025. \fB$+\fP    Match one or more tokens
  2026. \fB$\-\fP    Match exactly one token
  2027. \fB$=\fP\fIx\fP    Match any token in class \fIx\fP
  2028. \fB$~\fP\fIx\fP    Match any token not in class \fIx\fP
  2029. .)b
  2030. If any of these match,
  2031. they are assigned to the symbol
  2032. .b $ \c
  2033. .i n
  2034. for replacement on the right hand side,
  2035. where
  2036. .i n
  2037. is the index in the LHS.
  2038. For example,
  2039. if the LHS:
  2040. .(b
  2041. $\-:$+
  2042. .)b
  2043. is applied to the input:
  2044. .(b
  2045. UCBARPA:eric
  2046. .)b
  2047. the rule will match, and the values passed to the RHS will be:
  2048. .(b
  2049. .ta 4n
  2050. $1    UCBARPA
  2051. $2    eric
  2052. .)b
  2053. .sh 3 "The right hand side"
  2054. .pp
  2055. When the left hand side of a rewriting rule matches,
  2056. the input is deleted and replaced by the right hand side.
  2057. Tokens are copied directly from the RHS
  2058. unless they begin with a dollar sign.
  2059. Metasymbols are:
  2060. .(b
  2061. .ta \w'$#mailer  'u
  2062. \fB$\fP\fIn\fP    Substitute indefinite token \fIn\fP from LHS
  2063. \fB$[\fP\fIname\fP\fB$]\fP    Canonicalize \fIname\fP
  2064. \fB$>\fP\fIn\fP    \*(lqCall\*(rq ruleset \fIn\fP
  2065. \fB$#\fP\fImailer\fP    Resolve to \fImailer\fP
  2066. \fB$@\fP\fIhost\fP    Specify \fIhost\fP
  2067. \fB$:\fP\fIuser\fP    Specify \fIuser\fP
  2068. .)b
  2069. .pp
  2070. The
  2071. .b $ \c
  2072. .i n
  2073. syntax substitutes the corresponding value from a
  2074. .b $+ ,
  2075. .b $\- ,
  2076. .b $* ,
  2077. .b $= ,
  2078. or
  2079. .b $~
  2080. match on the LHS.
  2081. It may be used anywhere.
  2082. .pp
  2083. A host name enclosed between
  2084. .b $[
  2085. and
  2086. .b $]
  2087. is looked up using the
  2088. .i gethostent \|(3)
  2089. routines and replaced by the canonical name.
  2090. For example,
  2091. .q $[csam$]
  2092. might become
  2093. .q lbl-csam.arpa
  2094. and
  2095. .q $[[128.32.130.2]$]
  2096. would become
  2097. .q vangogh.berkeley.edu.
  2098. .pp
  2099. The
  2100. .b $> \c
  2101. .i n
  2102. syntax
  2103. causes the remainder of the line to be substituted as usual
  2104. and then passed as the argument to ruleset
  2105. .i n .
  2106. The final value of ruleset
  2107. .i n
  2108. then becomes
  2109. the substitution for this rule.
  2110. .pp
  2111. The
  2112. .b $#
  2113. syntax should
  2114. .i only
  2115. be used in ruleset zero.
  2116. It causes evaluation of the ruleset to terminate immediately,
  2117. and signals to sendmail that the address has completely resolved.
  2118. The complete syntax is:
  2119. .(b
  2120. \fB$#\fP\fImailer\fP\fB$@\fP\fIhost\fP\fB$:\fP\fIuser\fP
  2121. .)b
  2122. This specifies the
  2123. {mailer, host, user}
  2124. 3-tuple necessary to direct the mailer.
  2125. If the mailer is local
  2126. the host part may be omitted.
  2127. The
  2128. .i mailer
  2129. and
  2130. .i host
  2131. must be a single word,
  2132. but the
  2133. .i user
  2134. may be multi-part.
  2135. .pp
  2136. A RHS may also be preceded by a
  2137. .b $@
  2138. or a
  2139. .b $:
  2140. to control evaluation.
  2141. A
  2142. .b $@
  2143. prefix causes the ruleset to return with the remainder of the RHS
  2144. as the value.
  2145. A
  2146. .b $:
  2147. prefix causes the rule to terminate immediately,
  2148. but the ruleset to continue;
  2149. this can be used to avoid continued application of a rule.
  2150. The prefix is stripped before continuing.
  2151. .pp
  2152. The
  2153. .b $@
  2154. and
  2155. .b $:
  2156. prefixes may precede a
  2157. .b $>
  2158. spec;
  2159. for example:
  2160. .(b
  2161. .ta 8n
  2162. R$+    $:$>7$1
  2163. .)b
  2164. matches anything,
  2165. passes that to ruleset seven,
  2166. and continues;
  2167. the
  2168. .b $:
  2169. is necessary to avoid an infinite loop.
  2170. .pp
  2171. Substitution occurs in the order described,
  2172. that is,
  2173. parameters from the LHS are substituted,
  2174. hostnames are canonicalized,
  2175. .q subroutines
  2176. are called,
  2177. and finally
  2178. .b $# ,
  2179. .b $@ ,
  2180. and
  2181. .b $:
  2182. are processed.
  2183. .sh 3 "Semantics of rewriting rule sets"
  2184. .pp
  2185. There are five rewriting sets
  2186. that have specific semantics.
  2187. These are related as depicted by figure 2.
  2188. .(z
  2189. .hl
  2190. .ie n \{\
  2191. .(c
  2192.                     +---+
  2193.                  -->| 0 |-->resolved address
  2194.                 /   +---+
  2195.                /            +---+   +---+
  2196.               /        ---->| 1 |-->| S |--
  2197.        +---+ / +---+  /     +---+   +---+  \e    +---+
  2198. addr-->| 3 |-->| D |--                      --->| 4 |-->msg
  2199.        +---+   +---+  \e     +---+   +---+  /    +---+
  2200.                         --->| 2 |-->| R |--
  2201.                             +---+   +---+
  2202. .)c
  2203.  
  2204. .\}
  2205. .el .ie !"\*(.T"" \
  2206. \{\
  2207. .PS
  2208. boxwid = 0.3i
  2209. boxht = 0.3i
  2210. movewid = 0.3i
  2211. moveht = 0.3i
  2212. linewid = 0.3i
  2213. lineht = 0.3i
  2214.  
  2215.     box invis "addr"; arrow
  2216. Box3:    box "3"
  2217. A1:    arrow
  2218. BoxD:    box "D"; line; L1: Here
  2219. C:    [
  2220.     C1:    arrow; box "1"; arrow; box "S"; line; E1: Here
  2221.         move to C1 down 0.5; right
  2222.     C2:    arrow; box "2"; arrow; box "R"; line; E2: Here
  2223.     ] with .w at L1 + (0.5, 0)
  2224.     move to C.e right 0.5
  2225. L4:    arrow; box "4"; arrow; box invis "msg"
  2226.     line from L1 to C.C1
  2227.     line from L1 to C.C2
  2228.     line from C.E1 to L4
  2229.     line from C.E2 to L4
  2230.     move to BoxD.n up 0.6; right
  2231. Box0:    arrow; box "0"
  2232.     arrow; box invis "resolved address" width 1.3
  2233.     line from 1/3 of the way between A1 and BoxD.w to Box0
  2234. .PE
  2235. .\}
  2236. .el .sp 2i
  2237. .ce
  2238. Figure 2 \*- Rewriting set semantics
  2239. .(c
  2240. D \*- sender domain addition
  2241. S \*- mailer-specific sender rewriting
  2242. R \*- mailer-specific recipient rewriting
  2243. .)c
  2244. .hl
  2245. .)z
  2246. .pp
  2247. Ruleset three
  2248. should turn the address into
  2249. .q "canonical form."
  2250. This form should have the basic syntax:
  2251. .(b
  2252. local-part@host-domain-spec
  2253. .)b
  2254. If no
  2255. .q @
  2256. sign is specified,
  2257. then the
  2258. host-domain-spec
  2259. .i may
  2260. be appended from the
  2261. sender address
  2262. (if the
  2263. .b C
  2264. flag is set in the mailer definition
  2265. corresponding to the
  2266. .i sending
  2267. mailer).
  2268. Ruleset three
  2269. is applied by sendmail
  2270. before doing anything with any address.
  2271. .pp
  2272. Ruleset zero
  2273. is applied after ruleset three
  2274. to addresses that are going to actually specify recipients.
  2275. It must resolve to a
  2276. .i "{mailer, host, user}"
  2277. triple.
  2278. The
  2279. .i mailer
  2280. must be defined in the mailer definitions
  2281. from the configuration file.
  2282. The
  2283. .i host
  2284. is defined into the
  2285. .b $h
  2286. macro
  2287. for use in the argv expansion of the specified mailer.
  2288. .pp
  2289. Rulesets one and two
  2290. are applied to all sender and recipient addresses respectively.
  2291. They are applied before any specification
  2292. in the mailer definition.
  2293. They must never resolve.
  2294. .pp
  2295. Ruleset four is applied to all addresses
  2296. in the message.
  2297. It is typically used
  2298. to translate internal to external form.
  2299. .sh 3 "Mailer flags etc."
  2300. .pp
  2301. There are a number of flags that may be associated with each mailer,
  2302. each identified by a letter of the alphabet.
  2303. Many of them are assigned semantics internally.
  2304. These are detailed in Appendix C.
  2305. Any other flags may be used freely
  2306. to conditionally assign headers to messages
  2307. destined for particular mailers.
  2308. .sh 3 "The \*(lqerror\*(rq mailer"
  2309. .pp
  2310. The mailer with the special name
  2311. .q error
  2312. can be used to generate a user error.
  2313. The (optional) host field is a numeric exit status to be returned,
  2314. and the user field is a message to be printed.
  2315. For example, the entry:
  2316. .(b
  2317. $#error$:Host unknown in this domain
  2318. .)b
  2319. on the RHS of a rule
  2320. will cause the specified error to be generated
  2321. if the LHS matches.
  2322. This mailer is only functional in ruleset zero.
  2323. .sh 2 "Building a Configuration File From Scratch"
  2324. .pp
  2325. Building a configuration table from scratch is an extremely difficult job.
  2326. Fortunately,
  2327. it is almost never necessary to do so;
  2328. nearly every situation that may come up
  2329. may be resolved by changing an existing table.
  2330. In any case,
  2331. it is critical that you understand what it is that you are trying to do
  2332. and come up with a philosophy for the configuration table.
  2333. This section is intended to explain what the real purpose
  2334. of a configuration table is
  2335. and to give you some ideas
  2336. for what your philosophy might be.
  2337. .sh 3 "What you are trying to do"
  2338. .pp
  2339. The configuration table has three major purposes.
  2340. The first and simplest
  2341. is to set up the environment for
  2342. .i sendmail .
  2343. This involves setting the options,
  2344. defining a few critical macros,
  2345. etc.
  2346. Since these are described in other places,
  2347. we will not go into more detail here.
  2348. .pp
  2349. The second purpose is to rewrite addresses in the message.
  2350. This should typically be done in two phases.
  2351. The first phase maps addresses in any format
  2352. into a canonical form.
  2353. This should be done in ruleset three.
  2354. The second phase maps this canonical form
  2355. into the syntax appropriate for the receiving mailer.
  2356. .i Sendmail
  2357. does this in three subphases.
  2358. Rulesets one and two
  2359. are applied to all sender and recipient addresses respectively.
  2360. After this,
  2361. you may specify per-mailer rulesets
  2362. for both sender and recipient addresses;
  2363. this allows mailer-specific customization.
  2364. Finally,
  2365. ruleset four is applied to do any default conversion
  2366. to external form.
  2367. .pp
  2368. The third purpose
  2369. is to map addresses into the actual set of instructions
  2370. necessary to get the message delivered.
  2371. Ruleset zero must resolve to the internal form,
  2372. which is in turn used as a pointer to a mailer descriptor.
  2373. The mailer descriptor describes the interface requirements
  2374. of the mailer.
  2375. .sh 3 "Philosophy"
  2376. .pp
  2377. The particular philosophy you choose will depend heavily
  2378. on the size and structure of your organization.
  2379. I will present a few possible philosophies here.
  2380. .pp
  2381. One general point applies to all of these philosophies:
  2382. it is almost always a mistake
  2383. to try to do full name resolution.
  2384. For example,
  2385. if you are trying to get names of the form
  2386. .q user@host
  2387. to the Arpanet,
  2388. it does not pay to route them to
  2389. .q xyzvax!decvax!ucbvax!c70:user@host
  2390. since you then depend on several links not under your control.
  2391. The best approach to this problem
  2392. is to simply forward to
  2393. .q xyzvax!user@host
  2394. and let xyzvax
  2395. worry about it from there.
  2396. In summary,
  2397. just get the message closer to the destination,
  2398. rather than determining the full path.
  2399. .sh 4 "Large site, many hosts \*- minimum information"
  2400. .pp
  2401. Berkeley is an example of a large site,
  2402. i.e., more than two or three hosts
  2403. and multiple mail connections.
  2404. We have decided that the only reasonable philosophy
  2405. in our environment
  2406. is to designate one host as the guru for our site.
  2407. It must be able to resolve any piece of mail it receives.
  2408. The other sites should have the minimum amount of information
  2409. they can get away with.
  2410. In addition,
  2411. any information they do have
  2412. should be hints rather than solid information.
  2413. .pp
  2414. For example,
  2415. a typical site on our local ether network is
  2416. .q monet.
  2417. When monet receives mail for delivery,
  2418. it checks whether it knows
  2419. that the destination host is directly reachable;
  2420. if so, mail is sent to that host.
  2421. If it receives mail for any unknown host,
  2422. it just passes it directly to
  2423. .q ucbvax,
  2424. our master host.
  2425. Ucbvax may determine that the host name is illegal
  2426. and reject the message,
  2427. or may be able to do delivery.
  2428. However, it is important to note that when a new mail connection is added,
  2429. the only host that
  2430. .i must
  2431. have its tables updated
  2432. is ucbvax;
  2433. the others
  2434. .i may
  2435. be updated if convenient,
  2436. but this is not critical.
  2437. .pp
  2438. This picture is slightly muddied
  2439. due to network connections that are not actually located
  2440. on ucbvax.
  2441. For example,
  2442. some UUCP connections are currently on
  2443. .q ucbarpa.
  2444. However,
  2445. monet
  2446. .i "does not"
  2447. know about this;
  2448. the information is hidden totally between ucbvax and ucbarpa.
  2449. Mail going from monet to a UUCP host
  2450. is transferred via the ethernet
  2451. from monet to ucbvax,
  2452. then via the ethernet from ucbvax to ucbarpa,
  2453. and then is submitted to UUCP.
  2454. Although this involves some extra hops,
  2455. we feel this is an acceptable tradeoff.
  2456. .pp
  2457. An interesting point is that it would be possible
  2458. to update monet
  2459. to send appropriate UUCP mail directly to ucbarpa
  2460. if the load got too high;
  2461. if monet failed to note a host as connected to ucbarpa
  2462. it would go via ucbvax as before,
  2463. and if monet incorrectly sent a message to ucbarpa
  2464. it would still be sent by ucbarpa
  2465. to ucbvax as before.
  2466. The only problem that can occur is loops,
  2467. for example,
  2468. if ucbarpa thought that ucbvax had the UUCP connection
  2469. and vice versa.
  2470. For this reason,
  2471. updates should
  2472. .i always
  2473. happen to the master host first.
  2474. .pp
  2475. This philosophy results as much from the need
  2476. to have a single source for the configuration files
  2477. (typically built using
  2478. .i m4 \|(1)
  2479. or some similar tool)
  2480. as any logical need.
  2481. Maintaining more than three separate tables by hand
  2482. is essentially an impossible job.
  2483. .sh 4 "Small site \*- complete information"
  2484. .pp
  2485. A small site
  2486. (two or three hosts and few external connections)
  2487. may find it more reasonable to have complete information
  2488. at each host.
  2489. This would require that each host
  2490. know exactly where each network connection is,
  2491. possibly including the names of each host on that network.
  2492. As long as the site remains small
  2493. and the the configuration remains relatively static,
  2494. the update problem will probably not be too great.
  2495. .sh 4 "Single host"
  2496. .pp
  2497. This is in some sense the trivial case.
  2498. The only major issue is trying to insure that you don't
  2499. have to know too much about your environment.
  2500. For example,
  2501. if you have a UUCP connection
  2502. you might find it useful to know about the names of hosts
  2503. connected directly to you,
  2504. but this is really not necessary
  2505. since this may be determined from the syntax.
  2506. .sh 3 "Relevant issues"
  2507. .pp
  2508. The canonical form you use
  2509. should almost certainly be as specified in
  2510. the Arpanet protocols
  2511. RFC819 and RFC822.
  2512. Copies of these RFC's are included on the
  2513. .i sendmail
  2514. tape
  2515. as
  2516. .i doc/rfc819.lpr
  2517. and
  2518. .i doc/rfc822.lpr .
  2519. .pp
  2520. RFC822
  2521. describes the format of the mail message itself.
  2522. .i Sendmail
  2523. follows this RFC closely,
  2524. to the extent that many of the standards described in this document
  2525. can not be changed without changing the code.
  2526. In particular,
  2527. the following characters have special interpretations:
  2528. .(b
  2529. < > ( ) " \e
  2530. .)b
  2531. Any attempt to use these characters for other than their RFC822
  2532. purpose in addresses is probably doomed to disaster.
  2533. .pp
  2534. RFC819
  2535. describes the specifics of the domain-based addressing.
  2536. This is touched on in RFC822 as well.
  2537. Essentially each host is given a name
  2538. which is a right-to-left dot qualified pseudo-path
  2539. from a distinguished root.
  2540. The elements of the path need not be physical hosts;
  2541. the domain is logical rather than physical.
  2542. For example,
  2543. at Berkeley
  2544. one legal host might be
  2545. .q a.CC.Berkeley.EDU ;
  2546. reading from right to left,
  2547. .q EDU
  2548. is a top level domain
  2549. comprising educational institutions,
  2550. .q Berkeley
  2551. is a logical domain name,
  2552. .q CC
  2553. represents the Computer Center,
  2554. (in this case a strictly logical entity),
  2555. and
  2556. .q a
  2557. is a host in the Computer Center.
  2558. .pp
  2559. Beware when reading RFC819
  2560. that there are a number of errors in it.
  2561. .sh 3 "How to proceed"
  2562. .pp
  2563. Once you have decided on a philosophy,
  2564. it is worth examining the available configuration tables
  2565. to decide if any of them are close enough
  2566. to steal major parts of.
  2567. Even under the worst of conditions,
  2568. there is a fair amount of boiler plate that can be collected safely.
  2569. .pp
  2570. The next step is to build ruleset three.
  2571. This will be the hardest part of the job.
  2572. Beware of doing too much to the address in this ruleset,
  2573. since anything you do will reflect through
  2574. to the message.
  2575. In particular,
  2576. stripping of local domains is best deferred,
  2577. since this can leave you with addresses with no domain spec at all.
  2578. Since
  2579. .i sendmail
  2580. likes to append the sending domain to addresses with no domain,
  2581. this can change the semantics of addresses.
  2582. Also try to avoid
  2583. fully qualifying domains in this ruleset.
  2584. Although technically legal,
  2585. this can lead to unpleasantly and unnecessarily long addresses
  2586. reflected into messages.
  2587. The Berkeley configuration files
  2588. define ruleset nine
  2589. to qualify domain names and strip local domains.
  2590. This is called from ruleset zero
  2591. to get all addresses into a cleaner form.
  2592. .pp
  2593. Once you have ruleset three finished,
  2594. the other rulesets should be relatively trivial.
  2595. If you need hints,
  2596. examine the supplied configuration tables.
  2597. .sh 3 "Testing the rewriting rules \*- the \-bt flag"
  2598. .pp
  2599. When you build a configuration table,
  2600. you can do a certain amount of testing
  2601. using the
  2602. .q "test mode"
  2603. of
  2604. .i sendmail .
  2605. For example,
  2606. you could invoke
  2607. .i sendmail
  2608. as:
  2609. .(b
  2610. sendmail \-bt \-Ctest.cf
  2611. .)b
  2612. which would read the configuration file
  2613. .q test.cf
  2614. and enter test mode.
  2615. In this mode,
  2616. you enter lines of the form:
  2617. .(b
  2618. rwset address
  2619. .)b
  2620. where
  2621. .i rwset
  2622. is the rewriting set you want to use
  2623. and
  2624. .i address
  2625. is an address to apply the set to.
  2626. Test mode shows you the steps it takes
  2627. as it proceeds,
  2628. finally showing you the address it ends up with.
  2629. You may use a comma separated list of rwsets
  2630. for sequential application of rules to an input;
  2631. ruleset three is always applied first.
  2632. For example:
  2633. .(b
  2634. 1,21,4 monet:bollard
  2635. .)b
  2636. first applies ruleset three to the input
  2637. .q monet:bollard.
  2638. Ruleset one is then applied to the output of ruleset three,
  2639. followed similarly by rulesets twenty-one and four.
  2640. .pp
  2641. If you need more detail,
  2642. you can also use the
  2643. .q \-d21
  2644. flag to turn on more debugging.
  2645. For example,
  2646. .(b
  2647. sendmail \-bt \-d21.99
  2648. .)b
  2649. turns on an incredible amount of information;
  2650. a single word address
  2651. is probably going to print out several pages worth of information.
  2652. .sh 3 "Building mailer descriptions"
  2653. .pp
  2654. To add an outgoing mailer to your mail system,
  2655. you will have to define the characteristics of the mailer.
  2656. .pp
  2657. Each mailer must have an internal name.
  2658. This can be arbitrary,
  2659. except that the names
  2660. .q local
  2661. and
  2662. .q prog
  2663. must be defined.
  2664. .pp
  2665. The pathname of the mailer must be given in the P field.
  2666. If this mailer should be accessed via an IPC connection,
  2667. use the string
  2668. .q [IPC]
  2669. instead.
  2670. .pp
  2671. The F field defines the mailer flags.
  2672. You should specify an
  2673. .q f
  2674. or
  2675. .q r
  2676. flag to pass the name of the sender as a
  2677. .b \-f
  2678. or
  2679. .b \-r
  2680. flag respectively.
  2681. These flags are only passed if they were passed to
  2682. .i sendmail,
  2683. so that mailers that give errors under some circumstances
  2684. can be placated.
  2685. If the mailer is not picky
  2686. you can just specify
  2687. .q "\-f $g"
  2688. in the argv template.
  2689. If the mailer must be called as
  2690. .b root
  2691. the
  2692. .q S
  2693. flag should be given;
  2694. this will not reset the userid
  2695. before calling the mailer\**.
  2696. .(f
  2697. \**\c
  2698. .i Sendmail
  2699. must be running setuid to root
  2700. for this to work.
  2701. .)f
  2702. If this mailer is local
  2703. (i.e., will perform final delivery
  2704. rather than another network hop)
  2705. the
  2706. .q l
  2707. flag should be given.
  2708. Quote characters
  2709. (backslashes and " marks)
  2710. can be stripped from addresses if the
  2711. .q s
  2712. flag is specified;
  2713. if this is not given
  2714. they are passed through.
  2715. If the mailer is capable of sending to more than one user
  2716. on the same host
  2717. in a single transaction
  2718. the
  2719. .q m
  2720. flag should be stated.
  2721. If this flag is on,
  2722. then the argv template containing
  2723. .b $u
  2724. will be repeated for each unique user
  2725. on a given host.
  2726. The
  2727. .q e
  2728. flag will mark the mailer as being
  2729. .q expensive,
  2730. which will cause
  2731. .i sendmail
  2732. to defer connection
  2733. until a queue run\**.
  2734. .(f
  2735. \**The
  2736. .q c
  2737. configuration option must be given
  2738. for this to be effective.
  2739. .)f
  2740. .pp
  2741. An unusual case is the
  2742. .q C
  2743. flag.
  2744. This flag applies to the mailer that the message is received from,
  2745. rather than the mailer being sent to;
  2746. if set,
  2747. the domain spec of the sender
  2748. (i.e., the
  2749. .q @host.domain
  2750. part)
  2751. is saved
  2752. and is appended to any addresses in the message
  2753. that do not already contain a domain spec.
  2754. For example,
  2755. a message of the form:
  2756. .(b
  2757. From: eric@ucbarpa
  2758. To: wnj@monet, mckusick
  2759. .)b
  2760. will be modified to:
  2761. .(b
  2762. From: eric@ucbarpa
  2763. To: wnj@monet, mckusick@ucbarpa
  2764. .)b
  2765. .i "if and only if"
  2766. the
  2767. .q C
  2768. flag is defined in the mailer corresponding to
  2769. .q eric@ucbarpa.
  2770. .pp
  2771. Other flags are described
  2772. in Appendix C.
  2773. .pp
  2774. The S and R fields in the mailer description
  2775. are per-mailer rewriting sets
  2776. to be applied to sender and recipient addresses
  2777. respectively.
  2778. These are applied after the sending domain is appended
  2779. and the general rewriting sets
  2780. (numbers one and two)
  2781. are applied,
  2782. but before the output rewrite
  2783. (ruleset four)
  2784. is applied.
  2785. A typical use is to append the current domain
  2786. to addresses that do not already have a domain.
  2787. For example,
  2788. a header of the form:
  2789. .(b
  2790. From: eric
  2791. .)b
  2792. might be changed to be:
  2793. .(b
  2794. From: eric@ucbarpa
  2795. .)b
  2796. or
  2797. .(b
  2798. From: ucbvax!eric
  2799. .)b
  2800. depending on the domain it is being shipped into.
  2801. These sets can also be used
  2802. to do special purpose output rewriting
  2803. in cooperation with ruleset four.
  2804. .pp
  2805. The E field defines the string to use
  2806. as an end-of-line indication.
  2807. A string containing only newline is the default.
  2808. The usual backslash escapes
  2809. (\er, \en, \ef, \eb)
  2810. may be used.
  2811. .pp
  2812. Finally,
  2813. an argv template is given as the E field.
  2814. It may have embedded spaces.
  2815. If there is no argv with a
  2816. .b $u
  2817. macro in it,
  2818. .i sendmail
  2819. will speak SMTP
  2820. to the mailer.
  2821. If the pathname for this mailer is
  2822. .q [IPC],
  2823. the argv should be
  2824. .(b
  2825. IPC $h [ \fIport\fP ]
  2826. .)b
  2827. where
  2828. .i port
  2829. is the optional port number
  2830. to connect to.
  2831. .pp
  2832. For example,
  2833. the specifications:
  2834. .(b
  2835. .ta \w'Mlocal, 'u +\w'P=/bin/mail, 'u +\w'F=rlsm, 'u +\w'S=10, 'u +\w'R=20, 'u
  2836. Mlocal,    P=/bin/mail,    F=rlsm    S=10,    R=20,    A=mail \-d $u
  2837. Mether,    P=[IPC],    F=meC,    S=11,    R=21,    A=IPC $h, M=100000
  2838. .)b
  2839. specifies a mailer to do local delivery
  2840. and a mailer for ethernet delivery.
  2841. The first is called
  2842. .q local,
  2843. is located in the file
  2844. .q /bin/mail,
  2845. takes a picky
  2846. .b \-r
  2847. flag,
  2848. does local delivery,
  2849. quotes should be stripped from addresses,
  2850. and multiple users can be delivered at once;
  2851. ruleset ten
  2852. should be applied to sender addresses in the message
  2853. and ruleset twenty
  2854. should be applied to recipient addresses;
  2855. the argv to send to a message will be the word
  2856. .q mail,
  2857. the word
  2858. .q \-d,
  2859. and words containing the name of the receiving user.
  2860. If a
  2861. .b \-r
  2862. flag is inserted
  2863. it will be between the words
  2864. .q mail
  2865. and
  2866. .q \-d.
  2867. The second mailer is called
  2868. .q ether,
  2869. it should be connected to via an IPC connection,
  2870. it can handle multiple users at once,
  2871. connections should be deferred,
  2872. and any domain from the sender address
  2873. should be appended to any receiver name
  2874. without a domain;
  2875. sender addresses should be processed by ruleset eleven
  2876. and recipient addresses by ruleset twenty-one.
  2877. There is a 100,000 byte limit on messages passed through this mailer.
  2878. .++ A
  2879. .+c "COMMAND LINE FLAGS"
  2880. .ba 0
  2881. .nr ii 1i
  2882. .pp
  2883. Arguments must be presented with flags before addresses.
  2884. The flags are:
  2885. .ip "\-f\ \fIaddr\fP"
  2886. The sender's machine address is
  2887. .i addr .
  2888. This flag is ignored unless the real user
  2889. is listed as a
  2890. .q "trusted user"
  2891. or if
  2892. .i addr
  2893. contains an exclamation point
  2894. (because of certain restrictions in UUCP).
  2895. .ip "\-r\ \fIaddr\fP"
  2896. An obsolete form of
  2897. .b \-f .
  2898. .ip "\-h\ \fIcnt\fP"
  2899. Sets the
  2900. .q "hop count"
  2901. to
  2902. .i cnt .
  2903. This represents the number of times this message has been processed
  2904. by
  2905. .i sendmail
  2906. (to the extent that it is supported by the underlying networks).
  2907. .i Cnt
  2908. is incremented during processing,
  2909. and if it reaches
  2910. MAXHOP
  2911. (currently 30)
  2912. .i sendmail
  2913. throws away the message with an error.
  2914. .ip \-F\fIname\fP
  2915. Sets the full name of this user to
  2916. .i name .
  2917. .ip \-n
  2918. Don't do aliasing or forwarding.
  2919. .ip \-t
  2920. Read the header for
  2921. .q To: ,
  2922. .q Cc: ,
  2923. and
  2924. .q Bcc:
  2925. lines, and send to everyone listed in those lists.
  2926. The
  2927. .q Bcc:
  2928. line will be deleted before sending.
  2929. Any addresses in the argument vector will be deleted
  2930. from the send list.
  2931. .ip \-b\fIx\fP
  2932. Set operation mode to
  2933. .i x .
  2934. Operation modes are:
  2935. .(b
  2936. .ta 4n
  2937. m    Deliver mail (default)
  2938. a    Run in arpanet mode (see below)
  2939. s    Speak SMTP on input side
  2940. d    Run as a daemon
  2941. t    Run in test mode
  2942. v    Just verify addresses, don't collect or deliver
  2943. i    Initialize the alias database
  2944. p    Print the mail queue
  2945. z    Freeze the configuration file
  2946. .)b
  2947. The special processing for the
  2948. ARPANET
  2949. includes reading the
  2950. .q "From:"
  2951. line from the header to find the sender,
  2952. printing
  2953. ARPANET
  2954. style messages
  2955. (preceded by three digit reply codes for compatibility with
  2956. the FTP protocol
  2957. [Neigus73, Postel74, Postel77]),
  2958. and ending lines of error messages with <CRLF>.
  2959. .ip \-q\fItime\fP
  2960. Try to process the queued up mail.
  2961. If the time is given,
  2962. a sendmail will run through the queue at the specified interval
  2963. to deliver queued mail;
  2964. otherwise, it only runs once.
  2965. .ip \-C\fIfile\fP
  2966. Use a different configuration file.
  2967. .i Sendmail
  2968. runs as the invoking user (rather than root)
  2969. when this flag is specified.
  2970. .ip \-d\fIlevel\fP
  2971. Set debugging level.
  2972. .ip \-o\fIx\|value\fP
  2973. Set option
  2974. .i x
  2975. to the specified
  2976. .i value .
  2977. These options are described in Appendix B.
  2978. .pp
  2979. There are a number of options that may be specified as
  2980. primitive flags
  2981. (provided for compatibility with
  2982. .i delivermail ).
  2983. These are the e, i, m, and v options.
  2984. Also,
  2985. the f option
  2986. may be specified as the
  2987. .b \-s
  2988. flag.
  2989. .+c "CONFIGURATION OPTIONS"
  2990. .pp
  2991. The following options may be set using the
  2992. .b \-o
  2993. flag on the command line
  2994. or the
  2995. .b O
  2996. line in the configuration file.
  2997. Many of them cannot be specified unless the invoking user is trusted.
  2998. .nr ii 1i
  2999. .ip A\fIfile\fP
  3000. Use the named
  3001. .i file
  3002. as the alias file.
  3003. If no file is specified,
  3004. use
  3005. .i aliases
  3006. in the current directory.
  3007. .ip a\fIN\fP
  3008. If set,
  3009. wait up to
  3010. .i N
  3011. minutes for an
  3012. .q @:@
  3013. entry to exist in the alias database
  3014. before starting up.
  3015. If it does not appear in
  3016. .i N
  3017. minutes,
  3018. rebuild the database
  3019. (if the
  3020. .b D
  3021. option is also set)
  3022. or issue a warning.
  3023. .ip B\fIc\fP
  3024. Set the blank substitution character to
  3025. .i c .
  3026. Unquoted spaces in addresses are replaced by this character.
  3027. .ip c
  3028. If an outgoing mailer is marked as being expensive,
  3029. don't connect immediately.
  3030. This requires that queueing be compiled in,
  3031. since it will depend on a queue run process to
  3032. actually send the mail.
  3033. .ip d\fIx\fP
  3034. Deliver in mode
  3035. .i x .
  3036. Legal modes are:
  3037. .(b
  3038. .ta 4n
  3039. i    Deliver interactively (synchronously)
  3040. b    Deliver in background (asynchronously)
  3041. q    Just queue the message (deliver during queue run)
  3042. .)b
  3043. .ip D
  3044. If set,
  3045. rebuild the alias database if necessary and possible.
  3046. If this option is not set,
  3047. .i sendmail
  3048. will never rebuild the alias database
  3049. unless explicitly requested
  3050. using
  3051. .b \-bi .
  3052. .ip e\fIx\fP
  3053. Dispose of errors using mode
  3054. .i x .
  3055. The values for
  3056. .i x
  3057. are:
  3058. .(b
  3059. p    Print error messages (default)
  3060. q    No messages, just give exit status
  3061. m    Mail back errors
  3062. w    Write back errors (mail if user not logged in)
  3063. e    Mail back errors and give zero exit stat always
  3064. .)b
  3065. .ip f
  3066. Save
  3067. Unix-style
  3068. .q From
  3069. lines at the front of headers.
  3070. Normally they are assumed redundant
  3071. and discarded.
  3072. .ip g\fIn\fP
  3073. Set the default group id
  3074. for mailers to run in
  3075. to
  3076. .i n .
  3077. .ip H\fIfile\fP
  3078. Specify the help file
  3079. for SMTP.
  3080. .ip I
  3081. Insist that the BIND name server be running
  3082. to resolve host names.
  3083. If this is not set and the name server is not running,
  3084. the
  3085. .i /etc/hosts
  3086. file will be considered complete.
  3087. In general, you do want to set this option
  3088. if your
  3089. .i /etc/hosts
  3090. file does not include all hosts known to you
  3091. or if you are using the MX (mail forwarding) feature of the BIND name server.
  3092. The name server will still be consulted
  3093. even if this option is not set, but
  3094. .i sendmail
  3095. will feel free to resort to reading
  3096. .i /etc/hosts
  3097. if the name server is not available.
  3098. Thus, you should
  3099. .i never
  3100. set this option if you do not run the name server.
  3101. .ip i
  3102. Ignore dots in incoming messages.
  3103. .ip L\fIn\fP
  3104. Set the default log level to
  3105. .i n .
  3106. .ip M\fIx\|value\fP
  3107. Set the macro
  3108. .i x
  3109. to
  3110. .i value .
  3111. This is intended only for use from the command line.
  3112. .ip m
  3113. Send to me too,
  3114. even if I am in an alias expansion.
  3115. .ip N\fInetname\fP
  3116. The name of the home network;
  3117. .q ARPA
  3118. by default.
  3119. The the argument of an SMTP
  3120. .q HELO
  3121. command is checked against
  3122. .q hostname.netname
  3123. where
  3124. .i hostname
  3125. is requested from the kernel for the current connection.
  3126. If they do not match,
  3127. .q Received:
  3128. lines are augmented by the name that is determined in this manner
  3129. so that messages can be traced accurately.
  3130. .ip o
  3131. Assume that the headers may be in old format,
  3132. i.e.,
  3133. spaces delimit names.
  3134. This actually turns on
  3135. an adaptive algorithm:
  3136. if any recipient address contains a comma, parenthesis,
  3137. or angle bracket,
  3138. it will be assumed that commas already exist.
  3139. If this flag is not on,
  3140. only commas delimit names.
  3141. Headers are always output with commas between the names.
  3142. .ip Q\fIdir\fP
  3143. Use the named
  3144. .i dir
  3145. as the queue directory.
  3146. .ip q\fIfactor\fP
  3147. Use
  3148. .i factor
  3149. as the multiplier in the map function
  3150. to decide when to just queue up jobs rather than run them.
  3151. This value is divided by the difference between the current load average
  3152. and the load average limit
  3153. (\c
  3154. .b x
  3155. flag)
  3156. to determine the maximum message priority
  3157. that will be sent.
  3158. Defaults to 10000.
  3159. .ip r\fItime\fP
  3160. Timeout reads after
  3161. .i time
  3162. interval.
  3163. .ip S\fIfile\fP
  3164. Log statistics in the named
  3165. .i file .
  3166. .ip s
  3167. Be super-safe when running things,
  3168. i.e.,
  3169. always instantiate the queue file,
  3170. even if you are going to attempt immediate delivery.
  3171. .i Sendmail
  3172. always instantiates the queue file
  3173. before returning control the the client
  3174. under any circumstances.
  3175. .ip T\fItime\fP
  3176. Set the queue timeout to
  3177. .i time .
  3178. After this interval,
  3179. messages that have not been successfully sent
  3180. will be returned to the sender.
  3181. .ip t\fIS,D\fP
  3182. Set the local time zone name to
  3183. .i S
  3184. for standard time and
  3185. .i D
  3186. for daylight time;
  3187. this is only used under version six.
  3188. .ip u\fIn\fP
  3189. Set the default userid for mailers to
  3190. .i n .
  3191. Mailers without the
  3192. .i S
  3193. flag in the mailer definition
  3194. will run as this user.
  3195. .ip v
  3196. Run in verbose mode.
  3197. .ip x\fILA\fP
  3198. When the system load average exceeds
  3199. .i LA ,
  3200. just queue messages
  3201. (i.e., don't try to send them).
  3202. .ip X\fILA\fP
  3203. When the system load average exceeds
  3204. .i LA ,
  3205. refuse incoming SMTP connections.
  3206. .ip y\fIfact\fP
  3207. The indicated
  3208. .i fact or
  3209. is added to the priority (thus
  3210. .i lowering
  3211. the priority of the job)
  3212. for each recipient,
  3213. i.e., this value penalizes jobs with large numbers of recipients.
  3214. .ip Y
  3215. If set,
  3216. deliver each job that is run from the queue in a separate process.
  3217. Use this option if you are short of memory,
  3218. since the default tends to consume considerable amounts of memory
  3219. while the queue is being processed.
  3220. .ip z\fIfact\fP
  3221. The indicated
  3222. .i fact or
  3223. is multiplied by the message class
  3224. (determined by the Precedence: field in the user header
  3225. and the
  3226. .b P
  3227. lines in the configuration file)
  3228. and subtracted from the priority.
  3229. Thus, messages with a higher Priority: will be favored.
  3230. .ip Z\fIfact\fP
  3231. The
  3232. .i fact or
  3233. is added to the priority
  3234. every time a job is processed.
  3235. Thus,
  3236. each time a job is processed,
  3237. its priority will be decreased by the indicated value.
  3238. In most environments this should be positive,
  3239. since hosts that are down are all too often down for a long time.
  3240. .+c "MAILER FLAGS"
  3241. The following flags may be set in the mailer description.
  3242. .nr ii 4n
  3243. .ip f
  3244. The mailer wants a
  3245. .b \-f
  3246. .i from
  3247. flag,
  3248. but only if this is a network forward operation
  3249. (i.e.,
  3250. the mailer will give an error
  3251. if the executing user
  3252. does not have special permissions).
  3253. .ip r
  3254. Same as
  3255. .b f ,
  3256. but sends a
  3257. .b \-r
  3258. flag.
  3259. .ip S
  3260. Don't reset the userid
  3261. before calling the mailer.
  3262. This would be used in a secure environment
  3263. where
  3264. .i sendmail
  3265. ran as root.
  3266. This could be used to avoid forged addresses.
  3267. This flag is suppressed if given from an
  3268. .q unsafe
  3269. environment
  3270. (e.g, a user's mail.cf file).
  3271. .ip n
  3272. Do not insert a UNIX-style
  3273. .q From
  3274. line on the front of the message.
  3275. .ip l
  3276. This mailer is local
  3277. (i.e.,
  3278. final delivery will be performed).
  3279. .ip s
  3280. Strip quote characters off of the address
  3281. before calling the mailer.
  3282. .ip m
  3283. This mailer can send to multiple users
  3284. on the same host
  3285. in one transaction.
  3286. When a
  3287. .b $u
  3288. macro occurs in the
  3289. .i argv
  3290. part of the mailer definition,
  3291. that field will be repeated as necessary
  3292. for all qualifying users.
  3293. .ip F
  3294. This mailer wants a
  3295. .q From:
  3296. header line.
  3297. .ip D
  3298. This mailer wants a
  3299. .q Date:
  3300. header line.
  3301. .ip M
  3302. This mailer wants a
  3303. .q Message-Id:
  3304. header line.
  3305. .ip x
  3306. This mailer wants a
  3307. .q Full-Name:
  3308. header line.
  3309. .ip P
  3310. This mailer wants a
  3311. .q Return-Path:
  3312. line.
  3313. .ip u
  3314. Upper case should be preserved in user names
  3315. for this mailer.
  3316. .ip h
  3317. Upper case should be preserved in host names
  3318. for this mailer.
  3319. .ip A
  3320. This is an Arpanet-compatible mailer,
  3321. and all appropriate modes should be set.
  3322. .ip U
  3323. This mailer wants Unix-style
  3324. .q From
  3325. lines with the ugly UUCP-style
  3326. .q "remote from <host>"
  3327. on the end.
  3328. .ip e
  3329. This mailer is expensive to connect to,
  3330. so try to avoid connecting normally;
  3331. any necessary connection will occur during a queue run.
  3332. .ip X
  3333. This mailer want to use the hidden dot algorithm
  3334. as specified in RFC821;
  3335. basically,
  3336. any line beginning with a dot
  3337. will have an extra dot prepended
  3338. (to be stripped at the other end).
  3339. This insures that lines in the message containing a dot
  3340. will not terminate the message prematurely.
  3341. .ip L
  3342. Limit the line lengths as specified in RFC821.
  3343. .ip P
  3344. Use the return-path in the SMTP
  3345. .q "MAIL FROM:"
  3346. command
  3347. rather than just the return address;
  3348. although this is required in RFC821,
  3349. many hosts do not process return paths properly.
  3350. .ip I
  3351. This mailer will be speaking SMTP
  3352. to another
  3353. .i sendmail
  3354. \*-
  3355. as such it can use special protocol features.
  3356. This option is not required
  3357. (i.e.,
  3358. if this option is omitted the transmission will still operate successfully,
  3359. although perhaps not as efficiently as possible).
  3360. .ip C
  3361. If mail is
  3362. .i received
  3363. from a mailer with this flag set,
  3364. any addresses in the header that do not have an at sign
  3365. (\c
  3366. .q @ )
  3367. after being rewritten by ruleset three
  3368. will have the
  3369. .q @domain
  3370. clause from the sender
  3371. tacked on.
  3372. This allows mail with headers of the form:
  3373. .(b
  3374. From: usera@hosta
  3375. To: userb@hostb, userc
  3376. .)b
  3377. to be rewritten as:
  3378. .(b
  3379. From: usera@hosta
  3380. To: userb@hostb, userc@hosta
  3381. .)b
  3382. automatically.
  3383. .ip E
  3384. Escape lines beginning with
  3385. .q From
  3386. in the message with a `>' sign.
  3387. .+c "OTHER CONFIGURATION"
  3388. .rm $0
  3389. .nr ii 1i
  3390. .pp
  3391. There are some configuration changes that can be made by
  3392. recompiling
  3393. .i sendmail .
  3394. These are located in two places:
  3395. .ip src/conf.h
  3396. Configuration parameters that may be tweaked by the installer
  3397. are included in conf.h.
  3398. .ip src/conf.c
  3399. Some special routines and a few variables
  3400. may be defined in conf.c.
  3401. For the most part these are selected from the settings
  3402. in conf.h.
  3403. .uh "Parameters in src/conf.h"
  3404. .pp
  3405. Parameters and compilation options
  3406. are defined in conf.h.
  3407. Most of these need not normally be tweaked;
  3408. common parameters are all in sendmail.cf.
  3409. However, the sizes of certain primitive vectors, etc.,
  3410. are included in this file.
  3411. The numbers following the parameters
  3412. are their default value.
  3413. .nr ii 1.2i
  3414. .ip "MAXLINE [1024]"
  3415. The maximum line length of any input line.
  3416. If message lines exceed this length
  3417. they will still be processed correctly;
  3418. however, header lines,
  3419. configuration file lines,
  3420. alias lines,
  3421. etc.,
  3422. must fit within this limit.
  3423. .ip "MAXNAME [256]"
  3424. The maximum length of any name,
  3425. such as a host or a user name.
  3426. .ip "MAXFIELD [2500]"
  3427. The maximum total length of any header field,
  3428. including continuation lines.
  3429. .ip "MAXPV [40]"
  3430. The maximum number of parameters to any mailer.
  3431. This limits the number of recipients that may be passed in one transaction.
  3432. .ip "MAXHOP [17]"
  3433. When a message has been processed more than this number of times,
  3434. sendmail rejects the message
  3435. on the assumption that there has been an aliasing loop.
  3436. This can be determined from the
  3437. .b \-h
  3438. flag
  3439. or by counting the number of trace fields
  3440. (i.e,
  3441. .q Received:
  3442. lines)
  3443. in the message header.
  3444. .ip "MAXATOM [100]"
  3445. The maximum number of atoms
  3446. (tokens)
  3447. in a single address.
  3448. For example,
  3449. the address
  3450. .q "eric@Berkeley"
  3451. is three atoms.
  3452. .ip "MAXMAILERS [25]"
  3453. The maximum number of mailers that may be defined
  3454. in the configuration file.
  3455. .ip "MAXRWSETS [30]"
  3456. The maximum number of rewriting sets
  3457. that may be defined.
  3458. .ip "MAXPRIORITIES [25]"
  3459. The maximum number of values for the
  3460. .q Precedence:
  3461. field that may be defined
  3462. (using the
  3463. .b P
  3464. line in sendmail.cf).
  3465. .ip "MAXTRUST [30]"
  3466. The maximum number of trusted users that may be defined
  3467. (using the
  3468. .b T
  3469. line in sendmail.cf).
  3470. .ip "MAXUSERENVIRON [40]"
  3471. The maximum number of items in the user environment
  3472. that will be passed to subordinate mailers.
  3473. .ip "QUEUESIZE [600]"
  3474. The maximum number of entries that will be processed
  3475. in a single queue run.
  3476. .lp
  3477. A number of other compilation options exist.
  3478. These specify whether or not specific code should be compiled in.
  3479. .nr ii 1i
  3480. .ip DBM
  3481. If set,
  3482. the
  3483. .q DBM
  3484. package in UNIX is used
  3485. (see
  3486. .i dbm(3X)
  3487. in [UNIX80]).
  3488. If not set,
  3489. a much less efficient algorithm for processing aliases is used.
  3490. .ip NDBM
  3491. If set,
  3492. the new version of the DBM library
  3493. that allows multiple databases will be used.
  3494. .q DBM
  3495. must also be set.
  3496. .ip DEBUG
  3497. If set, debugging information is compiled in.
  3498. To actually get the debugging output,
  3499. the
  3500. .b \-d
  3501. flag must be used.
  3502. .ip LOG
  3503. If set,
  3504. the
  3505. .i syslog
  3506. routine in use at some sites is used.
  3507. This makes an informational log record
  3508. for each message processed,
  3509. and makes a higher priority log record
  3510. for internal system errors.
  3511. .ip QUEUE
  3512. This flag should be set to compile in the queueing code.
  3513. If this is not set,
  3514. mailers must accept the mail immediately
  3515. or it will be returned to the sender.
  3516. .ip SMTP
  3517. If set,
  3518. the code to handle user and server SMTP will be compiled in.
  3519. This is only necessary if your machine has some mailer
  3520. that speaks SMTP.
  3521. .ip DAEMON
  3522. If set,
  3523. code to run a daemon is compiled in.
  3524. This code is for 4.2 or 4.3BSD.
  3525. .ip UGLYUUCP
  3526. If you have a UUCP host adjacent to you which is not running
  3527. a reasonable version of
  3528. .i rmail ,
  3529. you will have to set this flag to include the
  3530. .q "remote from sysname"
  3531. info on the from line.
  3532. Otherwise, UUCP gets confused about where the mail came from.
  3533. .ip NOTUNIX
  3534. If you are using a non-UNIX mail format,
  3535. you can set this flag to turn off special processing
  3536. of UNIX-style
  3537. .q "From "
  3538. lines.
  3539. .ip NAMED_BIND
  3540. Compile in code to use the Berkeley Internet Name Domain (BIND) server
  3541. to resolve TCP/IP host names.
  3542. .ip SETPROCTITLE
  3543. If defined,
  3544. .i sendmail
  3545. will change its
  3546. .i argv
  3547. array to indicate its current status.
  3548. This can be used in conjunction with the
  3549. .i ps
  3550. command to find out just what it's up to.
  3551. .ip NO_WILDCARD_MX
  3552. Should be set if there are no wildcard MX nameserver records
  3553. in the local domain.
  3554. If set, this will enable the use of ANY query types, resulting
  3555. in better performance.
  3556. Unfortunately, wildcard MX records in the local domain will mess
  3557. this up, hence the need for this compilation option.
  3558. .uh "Configuration in src/conf.c"
  3559. .pp
  3560. Not all header semantics are defined in the configuration file.
  3561. Header lines that should only be included by certain mailers
  3562. (as well as other more obscure semantics)
  3563. must be specified in the
  3564. .i HdrInfo
  3565. table in
  3566. .i conf.c .
  3567. This table contains the header name
  3568. (which should be in all lower case)
  3569. and a set of header control flags (described below),
  3570. The flags are:
  3571. .ip H_ACHECK
  3572. Normally when the check is made to see if a header line is compatible
  3573. with a mailer,
  3574. .i sendmail
  3575. will not delete an existing line.
  3576. If this flag is set,
  3577. .i sendmail
  3578. will delete
  3579. even existing header lines.
  3580. That is,
  3581. if this bit is set and the mailer does not have flag bits set
  3582. that intersect with the required mailer flags
  3583. in the header definition in
  3584. sendmail.cf,
  3585. the header line is
  3586. .i always
  3587. deleted.
  3588. .ip H_EOH
  3589. If this header field is set,
  3590. treat it like a blank line,
  3591. i.e.,
  3592. it will signal the end of the header
  3593. and the beginning of the message text.
  3594. .ip H_FORCE
  3595. Add this header entry
  3596. even if one existed in the message before.
  3597. If a header entry does not have this bit set,
  3598. .i sendmail
  3599. will not add another header line if a header line
  3600. of this name already existed.
  3601. This would normally be used to stamp the message
  3602. by everyone who handled it.
  3603. .ip H_TRACE
  3604. If set,
  3605. this is a timestamp
  3606. (trace)
  3607. field.
  3608. If the number of trace fields in a message
  3609. exceeds a preset amount
  3610. the message is returned
  3611. on the assumption that it has an aliasing loop.
  3612. .ip H_RCPT
  3613. If set,
  3614. this field contains recipient addresses.
  3615. This is used by the
  3616. .b \-t
  3617. flag to determine who to send to
  3618. when it is collecting recipients from the message.
  3619. .ip H_FROM
  3620. This flag indicates that this field
  3621. specifies a sender.
  3622. The order of these fields in the
  3623. .i HdrInfo
  3624. table specifies
  3625. .i sendmail's
  3626. preference
  3627. for which field to return error messages to.
  3628. .nr ii 5n
  3629. .lp
  3630. Let's look at a sample
  3631. .i HdrInfo
  3632. specification:
  3633. .(b
  3634. .ta 4n +\w'"return-receipt-to",  'u
  3635. struct hdrinfo    HdrInfo[] =
  3636. \&{
  3637.          /* originator fields, most to least significant  */
  3638.     "resent-sender",    H_FROM,
  3639.     "resent-from",    H_FROM,
  3640.     "sender",    H_FROM,
  3641.     "from",    H_FROM,
  3642.     "full-name",    H_ACHECK,
  3643.          /* destination fields */
  3644.     "to",    H_RCPT,
  3645.     "resent-to",    H_RCPT,
  3646.     "cc",    H_RCPT,
  3647.          /* message identification and control */
  3648.     "message",    H_EOH,
  3649.     "text",    H_EOH,
  3650.          /* trace fields */
  3651.     "received",    H_TRACE|H_FORCE,
  3652.  
  3653.     NULL,    0,
  3654. };
  3655. .)b
  3656. This structure indicates that the
  3657. .q To: ,
  3658. .q Resent-To: ,
  3659. and
  3660. .q Cc:
  3661. fields
  3662. all specify recipient addresses.
  3663. Any
  3664. .q Full-Name:
  3665. field will be deleted unless the required mailer flag
  3666. (indicated in the configuration file)
  3667. is specified.
  3668. The
  3669. .q Message:
  3670. and
  3671. .q Text:
  3672. fields will terminate the header;
  3673. these are specified in new protocols
  3674. [NBS80]
  3675. or used by random dissenters around the network world.
  3676. The
  3677. .q Received:
  3678. field will always be added,
  3679. and can be used to trace messages.
  3680. .pp
  3681. There are a number of important points here.
  3682. First,
  3683. header fields are not added automatically just because they are in the
  3684. .i HdrInfo
  3685. structure;
  3686. they must be specified in the configuration file
  3687. in order to be added to the message.
  3688. Any header fields mentioned in the configuration file but not
  3689. mentioned in the
  3690. .i HdrInfo
  3691. structure have default processing performed;
  3692. that is,
  3693. they are added unless they were in the message already.
  3694. Second,
  3695. the
  3696. .i HdrInfo
  3697. structure only specifies cliched processing;
  3698. certain headers are processed specially by ad hoc code
  3699. regardless of the status specified in
  3700. .i HdrInfo .
  3701. For example,
  3702. the
  3703. .q Sender:
  3704. and
  3705. .q From:
  3706. fields are always scanned on ARPANET mail
  3707. to determine the sender;
  3708. this is used to perform the
  3709. .q "return to sender"
  3710. function.
  3711. The
  3712. .q "From:"
  3713. and
  3714. .q "Full-Name:"
  3715. fields are used to determine the full name of the sender
  3716. if possible;
  3717. this is stored in the macro
  3718. .b $x
  3719. and used in a number of ways.
  3720. .pp
  3721. The file
  3722. .i conf.c
  3723. also contains the specification of ARPANET reply codes.
  3724. There are four classifications these fall into:
  3725. .(b
  3726. .sz -1
  3727. .ta \w'char  'u +\w'Arpa_TUsrerr[] =  'u +\w'"888";  'u
  3728. char    Arpa_Info[] =    "050";    /* arbitrary info */
  3729. char    Arpa_TSyserr[] =    "455";    /* some (transient) system error */
  3730. char    Arpa_PSyserr[] =    "554";    /* some (permanent) system error */
  3731. char    Arpa_Usrerr[] =    "554";    /* some (fatal) user error */
  3732. .sz
  3733. .)b
  3734. The class
  3735. .i Arpa_Info
  3736. is for any information that is not required by the protocol,
  3737. such as forwarding information.
  3738. .i Arpa_TSyserr
  3739. and
  3740. .i Arpa_PSyserr
  3741. is printed by the
  3742. .i syserr
  3743. routine.
  3744. TSyserr
  3745. is printed out for transient errors,
  3746. that is,
  3747. errors that are likely to go away without explicit action
  3748. on the part of a systems administrator.
  3749. PSyserr
  3750. is printed for permanent errors.
  3751. The distinction is made based on the value of
  3752. .i errno .
  3753. Finally,
  3754. .i Arpa_Usrerr
  3755. is the result of a user error
  3756. and is generated by the
  3757. .i usrerr
  3758. routine;
  3759. these are generated when the user has specified something wrong,
  3760. and hence the error is permanent,
  3761. i.e.,
  3762. it will not work simply by resubmitting the request.
  3763. .pp
  3764. If it is necessary to restrict mail through a relay,
  3765. the
  3766. .i checkcompat
  3767. routine can be modified.
  3768. This routine is called for every recipient address.
  3769. It can return
  3770. .b TRUE
  3771. to indicate that the address is acceptable
  3772. and mail processing will continue,
  3773. or it can return
  3774. .b FALSE
  3775. to reject the recipient.
  3776. If it returns false,
  3777. it is up to
  3778. .i checkcompat
  3779. to print an error message
  3780. (using
  3781. .i usrerr )
  3782. saying why the message is rejected.
  3783. For example,
  3784. .i checkcompat
  3785. could read:
  3786. .(b
  3787. .re
  3788. .sz -1
  3789. .ta 4n +4n +4n +4n +4n +4n +4n
  3790. bool
  3791. checkcompat(to)
  3792.     register ADDRESS *to;
  3793. \&{
  3794.     if (MsgSize > 50000 && to->q_mailer != LocalMailer)
  3795.     {
  3796.         usrerr("Message too large for non-local delivery");
  3797.         NoReturn = TRUE;
  3798.         return (FALSE);
  3799.     }
  3800.     return (TRUE);
  3801. }
  3802. .sz
  3803. .)b
  3804. This would reject messages greater than 50000 bytes
  3805. unless they were local.
  3806. The
  3807. .i NoReturn
  3808. flag can be sent to suppress the return of the actual body
  3809. of the message in the error return.
  3810. The actual use of this routine is highly dependent on the
  3811. implementation,
  3812. and use should be limited.
  3813. .uh "Configuration in src/daemon.c"
  3814. .pp
  3815. The file
  3816. .i src/daemon.c
  3817. contains a number of routines that are dependent
  3818. on the local networking environment.
  3819. The version supplied is specific to 4.3 BSD.
  3820. .pp
  3821. The routine
  3822. .i maphostname
  3823. is called to convert strings within
  3824. .b $[
  3825. \&...\&
  3826. .b $]
  3827. symbols.
  3828. It can be modified if you wish to provide a more sophisticated service,
  3829. e.g.,
  3830. mapping UUCP host names to full paths.
  3831. .+c "SUMMARY OF SUPPORT FILES"
  3832. .pp
  3833. This is a summary of the support files
  3834. that
  3835. .i sendmail
  3836. creates or generates.
  3837. .nr ii 1i
  3838. .ip "/usr/lib/sendmail"
  3839. The binary of
  3840. .i sendmail .
  3841. .ip /usr/bin/newaliases
  3842. A link to /usr/lib/sendmail;
  3843. causes the alias database to be rebuilt.
  3844. Running this program is completely equivalent to giving
  3845. .i sendmail
  3846. the
  3847. .b \-bi
  3848. flag.
  3849. .ip /usr/bin/mailq
  3850. Prints a listing of the mail queue.
  3851. This program is equivalent to using the
  3852. .b \-bp
  3853. flag to
  3854. .i sendmail .
  3855. .ip /usr/lib/sendmail.cf
  3856. The configuration file,
  3857. in textual form.
  3858. .ip /usr/lib/sendmail.fc
  3859. The configuration file
  3860. represented as a memory image.
  3861. .ip /usr/lib/sendmail.hf
  3862. The SMTP help file.
  3863. .ip /usr/lib/sendmail.st
  3864. A statistics file; need not be present.
  3865. .ip /usr/lib/aliases
  3866. The textual version of the alias file.
  3867. .ip /usr/lib/aliases.{pag,dir}
  3868. The alias file in
  3869. .i dbm \|(3)
  3870. format.
  3871. .ip /usr/spool/mqueue
  3872. The directory in which the mail queue
  3873. and temporary files reside.
  3874. .ip /usr/spool/mqueue/qf*
  3875. Control (queue) files for messages.
  3876. .ip /usr/spool/mqueue/df*
  3877. Data files.
  3878. .ip /usr/spool/mqueue/lf*
  3879. Lock files
  3880. .ip /usr/spool/mqueue/tf*
  3881. Temporary versions of the qf files,
  3882. used during queue file rebuild.
  3883. .ip /usr/spool/mqueue/nf*
  3884. A file used when creating a unique id.
  3885. .ip /usr/spool/mqueue/xf*
  3886. A transcript of the current session.
  3887. .\".ro
  3888. .\".ls 1
  3889. .\".tp
  3890. .\".sp 2i
  3891. .\".in 0
  3892. .\".ce 100
  3893. .\".sz 24
  3894. .\".b SENDMAIL
  3895. .\".sz 14
  3896. .\".sp
  3897. .\"INSTALLATION AND OPERATION GUIDE
  3898. .\".sp
  3899. .\".sz 10
  3900. .\"Eric Allman
  3901. .\"Britton-Lee, Inc.
  3902. .\".sp
  3903. .\"Version 5.11
  3904. .\".ce 0
  3905. .pn 2
  3906. .bp
  3907. .ce
  3908. .sz 12
  3909. TABLE OF CONTENTS
  3910. .sz 10
  3911. .sp
  3912. .\" remove some things to avoid "out of temp file space" problem
  3913. .rm sh
  3914. .rm (x
  3915. .rm )x
  3916. .rm ip
  3917. .rm pp
  3918. .rm lp
  3919. .rm he
  3920. .rm fo
  3921. .rm eh
  3922. .rm oh
  3923. .rm ef
  3924. .rm of
  3925. .xp
  3926.