23.1 Enable at Compile Time

Vendors that provide V8 sendmail in precompiled form might or might not provide access to all the types of databases that V8 sendmail supports. If your online documentation lacks this information, you can run sendmail with the -d0.4 debugging switch to discover what it supports:

% /usr/sbin/sendmail -d0.4 -bt

Version 8.12.7

In this implementation of sendmail the following databases are available: regular-expression (the MAP_REGEX), Sun nis (the NIS), the bestmx database-map type (the NAMED_BIND), and the Sleepycat DB's hash and btree types (the NEWDB). Many internal database maps needed by sendmail are also automatically included without being enabled. They are text, stab, implicit, user, host, program, sequence, null, syslog, arith, macro, and switch. Note that hesiod and nisplus database maps are not supported by this particular sendmail binary (neither HESIOD nor NISPLUS was printed in the preceding output).

If you download and compile sendmail yourself, you can include any supported databases. Support is declared in your m4 Build file. For example, the following includes support for the dns database-map type:


Here, APPENDDEF is used to append the compile-time switch to any previous definitions. The -DDNSMAP is the compile-time switch that, when given a positive, nonzero value, enables inclusion of that support.

Possible compile-time switches are shown in Table 23-1.

Table 23-1. m4 definitions for confMAPDEF



Database support included



dns lookups (V8.12 and above)



hesiod(3) aliases, and userdb


ldap (was ldapx)




Irix nsd



Regular expression support



ndbm(3) database files (dbm)



bestmx(3) DNS lookups



NeXT netinfo(3) aliases only



db(3) hash and btree databases, and userdb



Sun NIS network database maps



Sun NIS+ network database maps



PH database maps

For example, the default Build m4 file for Ultrix (in devtools/OS/ULTRIX) might include this line:

define(`confMAPDEF', `-DNDBM=1 -DNIS=1')

which includes support for ndbm(3) and nis(3) database maps, whereas the m4 file for SunOS 5.5 might include the following:

define(`confMAPDEF', `-DNDBM=1 -DNIS=1 -DNISPLUS=1 -DMAP_REGEX=1')

which also includes support for the nisplus database map and regular expressions.

Beginning with V8.9, sendmail automatically determines whether NEWDB should be included by default. Only nonstandard locations of the db libraries will prevent this. So, in addition to the database support shown earlier, standard installations will also have db(3) support.

If you omit all database support with a declaration such as this in your m4 Build file:

define(`confMAPDEF', `')

and if your db libraries are in a nonstandard location, a sendmail binary will be created that will be unable to maintain its aliases in database format. Also, any attempt to rebuild the aliases database (with newaliases or with -bi) will fail with the following error message:

Cannot rebuild aliases: no database format defined
Cannot create database for alias file /etc/mail/aliases: No such device

Note that if you add new database-map types, you might also have to add to your m4 Build configuration file libraries with the confLIBS compile-time macro (confLIBDIRS) and #include-file directories with the confINCDIRS compile-time macro (confINCDIRS). For example:

APPENDDEF(`confINCDIRS', `-I/packages/include/db')
APPENDDEF(`confLIBDIRS', `-L/packages/lib')

Here, support for db(3) is included where it otherwise would not have been because of its nonstandard location in /packages.

23.1.1 Create Files with makemap

The makemap program, supplied in source form with V8 sendmail, is fully described in Section 5.5. It is used to create database files and is run, in brief, from the command line like this:

% makemap type file < textfile 

The type can be either dbm (which uses the ndbm(3) library routines), hash, or btree (both of which use the db(3) library routines). The file is the location and name (full path or relative name) for the database file to create. For dbm files, the .pag and .dir suffixes are added automatically. For db files, the .db suffix will be added automatically if it is not already included in the name.

The makemap program reads from its standard input. That input is line-oriented and contains the text from which the database files will be created. Lines that begin with a # are interpreted as comments and ignored. Lines that contain no characters (empty lines) are also ignored. Whitespace (spaces or tabs) separates the key on the left from the data on the right. An example of such an input file is the following:

lady     relaysite!lady
my.host  relaysite!lady
bug      bug.localuucp

The second line in this example shows that keys can be multitokened (my.host is three tokens). In reading from existing files, some conversion might be required to massage the input into a usable form. To make a database of the /etc/hosts file (for converting hostnames into IP addresses), for example, a command line such as the following might be required:[1]

[1] This simplified example won't work if the /etc/hosts file has multiple hostnames on the right hand side. For more complicated situations such as this, a shell script might be required.

% awk '/^[^#]/ {print $2, $1}' /etc/hosts | makemap ...

Here, awk(1) needs to eliminate comment lines (the /^[^#]/). Otherwise, it will wrongly move them to the second column, where makemap will not recognize them as comments.

    Part I: Build and Install
    Part II: Administration
    Part III: The Configuration File
    Chapter 21. The D (Define a Macro) Configuration Command
    Chapter 24. The O (Options) Configuration Command