Web linux-server.50webs.com

Linux Mail Server

Building a sendmail Database:

The configuration we have just created works fine. It operates just like the sendmail.cf that was created earlier, including masquerading hostnames as foobirds.org. But we also want to convert the username part of outbound addresses from the login name to the user's real name written as firstname.lastname. To do that, create a database to convert the username part of outbound e-mail addresses. Build the database by creating a text file with the necessary data and processing that file through the makemap command that comes with the sendmail distribution.

The genericstable database is a database that sendmail uses to convert outbound e-mail addresses. By default, the file is built in the /etc/mail directory. The listing below shows a simple genericstable file.


pat Pat.Stover
mandy Amanda.Jenkins
kathy Kathy.McCafferty
sara Sara.Henson
norm Norman.Edwards
craig Craig.Hunt

Every entry in the genericstable database has two fields: The first field is the key, and the second is the value returned by the key. In the sample database, the key is the login name, and the return value is the user's real name. Using this database, a query for "pat" will return the value "Pat.Stover."

Before the genericstable can be used by sendmail, it must be converted from a text file to a database with the makemap command, which is included in the sendmail distribution. Assume that the data shown in the previous listing are stored in a file named usernames.txt. The following command would convert that file to a genericstable database:

# makemap hash genericstable < usernames.txt

The sample makemap command creates a hash type database, which is the most commonly used. makemap can create other types of databases, but hash is the default type that sendmail uses for most databases.

After this genericstable database is created, login names on outbound mail are converted to full names. For example, the username mandy is converted to Amanda.Jenkins. Combining this with domain name masquerading rewrites outbound addresses into the firstname.lastname@domain format.

.