Sendmail: Theory and Practice, Second Edition

Chapter 7: Table Driven Delivery

Sendmail R8 allows much of the address rewriting policy, and in fact much of the routing policy, to be stored external to the sendmail.cf in various kinds of tables. These tables are often hash keyed databases (".db files"), but you don't have to know very much about that in order to use them. Sendmail comes with a utility called makemap that translates ordinary text files into searchable tables. If you can express your table in terms of keys and values, the actual storage details will be handled for you by the utilities.

7.1. Syntax

The fundamental sendmail.cf operator for using tables is the $(..$) construct, which takes as arguments a "map name", a "lookup key" (often a user, host, or domain name), an optional "argument" (useful if you embed sprintf style " %1" strings in your table values), and a "default value," which is almost always used to control subsequent processing in case the table lookup fails. The full glory of this construct is usually shown as:

<span class="fixed">$(</span> <i class="emphasis">map key</i> <span class="fixed">[ $@</span> <i class="emphasis">arguments</i> <span class="fixed">][ $:</span> <i class="emphasis">default</i> <span class="fixed">] $)</span>

The map is a named map that has been associated with some external table using the K directive early on in the sendmail.cf. For example,

Ktransmogrify hash -a@! /var/sendmail/transmogrify

which says that map transmogrify is a hash (that is to say, a ".db file") and that the string @! should be appended to...

UNLIMITED FREE
ACCESS
TO THE WORLD'S BEST IDEAS

SUBMIT
Already a GlobalSpec user? Log in.

This is embarrasing...

An error occurred while processing the form. Please try again in a few minutes.

Customize Your GlobalSpec Experience

Category: Switching Power Supplies
Finish!
Privacy Policy

This is embarrasing...

An error occurred while processing the form. Please try again in a few minutes.