Database Maps

One of the most useful features of sendmail is its ability to look up addresses based on external maps. Many different types of maps are supported, ranging from local DB or DBM databases to network-based services such as PH, LDAP, or NIS. If sendmail was compiled with -DNEWDB, the default map type is hash. Otherwise, the default map type is dbm.

There are several FEATURE() macros which allow you to make use of the maps supported by sendmail:

Feature Explanation
FEATURE(virtusertable) This map allows you to support virtual domains on a single mail server. Here's an example database:
info@foo.com    foo-info
info@bar.com    bar-info
joe@bar.com     error:nouser No such user here
jax@bar.com     error:D.S.N:unavailable Address invalid
@baz.org        jane@example.net
@foo.org        %1@example.com
old+*@foo.org   new+%2@example.com
Email sent to the addresses on the left will be delivered to the corresponding address on the right. If the address on the right starts with error:, the mail is bounced with the specified error message. If the address on the left does not have a user name, all users at the specified domain will be sent to the address on the right, and the %1 token will be replaced with the username from the original address. If the original address is of the form "user+detail", it will match an entry of user+* on the left, and the token %2 will be replaced with the original "detail" string.

The default filename for this database is /etc/mail/virtusertable.

FEATURE(domaintable) Allows for selective rewriting of domain names. For example, the entry ux4.cso.uiuc.edu students.uiuc.edu would cause all email for ux4.cso.uiuc.edu to be processed as students.uiuc.edu.

The default filename for this database is /etc/mail/domaintable.

FEATURE(mailertable) A mailertable is a database which maps certain hosts or domains to a mailer:host pair. It is used for redirecting mail addressed to a certain host or domain to a specific destination host using a specific mailer (for example, for using phquery).

The default filename for this database is /etc/mail/mailertable.

FEATURE(access_db) This sets up an access control database, which allows the administrator to control what users and hosts are allowed to send mail to the local machine or are allowed to relay mail through the local machine. See the Anti-Spam page for more information.

The default filename for this database is /etc/mail/access.

Each feature macro accepts an optional argument which can override the default map type and database name. For example, the default filename for the mailertable map is /etc/mail/mailertable. To force it to use a dbm map using the file /etc/mailmap, you would use something like this:

FEATURE(mailertable, dbm -o /etc/mailmap)
Note that using -o before the filename tells sendmail that the map is optional, so that it is not considered an error if the map does not exist.



Mark D. Roth <roth@feep.net>