SCO recommends that administrators always use the Mail Manager to configure mail channels within sendmail. However, some experienced administrators may still wish to hand edit the sendmail configuration file, sendmail.cf. This topic discusses the sendmail.cf implementation of mail channels, in order to assist administrators in effective manual configuration. ``Sendmail Operation Guide'' gives a definition of the sendmail.cf commands.
The configuration file, sendmail.cf, operates on the assumption that all messages should be delivered via mail channels. The channel table determines what messages will be delivered by the channel, whereupon the channel delivery agent performs the actual delivery.
These two components can be associated with their sendmail.cf counterparts: the table is a ruleset which performs a lookup, sometimes using sendmail database macros, while the delivery agent directly corresponds to the sendmail delivery agent defined by the M configuration file command (see ``M: define mailer'' for details).
Every sendmail.cf uses ruleset 0 to determine which mail delivery agent will handle delivery for a particular recipient address. At the end of ruleset 0, a call to a new ruleset is made, called ``channels'', which puts the address through the configured mail channels. Each rule of ruleset ``channels'' in turn calls another ruleset to do the processing for a single channel. This level of abstraction is used to easily re-order the channels, which is a feature available in the Mail Manager. There is one mail channel that may be configured which will not have a corresponding rule in the ``channels'' ruleset. This is the baduser channel; see ``Channel tables'' for a discussion of this.
Each individual channel ruleset in turn passes the address to another ruleset which performs the channel table lookup, and if a successful match was found in the table, resolves the address to the ruleset 0 ``triple''. This, as its name suggests, is composed of three parts:
By convention, the Mail Manager uses the name chosen for the created channel as the symbolic name of the channel's ruleset and delivery agent. For example, consider the following possible configuration to illustrate the sendmail.cf implementation. Suppose that three channels have been configured, named ``Local'', ``SMTP'', and ``UUCP''. Then ruleset ``channels'' would have three rules that make calls to subroutines named after these channels:
R$* $: $>Local $1 R$* $: $>SMTP $1 R$* $: $>UUCP $1The left hand side of each rule simply matches all addresses and passes them to the ruleset corresponding to the channel.
The ruleset for the SMTP channel may look as follows:
R$* < @ $+ . > $* $: $>dns_TBL $1<@$2.>$3 R< FOUND > $* < @ $+ . > $* $# SMTP $@ $2 $: $1<@$2.>$3If you are not familiar with sendmail.cf rule syntax, please refer to ``Sendmail Operation Guide'', which contains a detailed discussion of sendmail.cf and all of its configuration commands. Essentially, the above ruleset, as do all channel rulesets, accomplishes the task of looking up the address in the channel's table, and resolving the delivery agent upon a match. In the SMTP example, the first rule passes the address to a ruleset called ``dns_TBL'', which implements the table lookup. In the second rule, if ``dns_TBL'' returns the address with the string ``<FOUND>'' prepended, then the ``SMTP'' delivery agent is chosen. The right hand side of the second rule gives the ruleset 0 triple.
Notice that the hostname portion of the triple (specified by the $@ operator) for ruleset SMTP is simply the focused hostname portion of the address. This is in keeping with normal SMTP mail delivery, as sendmail will need to know this hostname in order to make the SMTP connection. However the hostname portion of the triple may be given different values, depending upon the type of channel created. For example, the Mail Manager allows you to specify the name of a forwarding host for the channel. In the corresponding ruleset for such a channel, the name of the forwarding host would be given to the hostname portion of the ruleset 0 triple. In general, the type of the channel table and whether a forwarding host has been specified are the two factors which determine the value of the hostname portion of the triple. Administrators who wish to create customized channels will need to know how this is determined, in order to pass on this value to the delivery program. Channel tables are discussed in more depth in ``Channel tables''.