If you have a version of sendmail(1M) with the user database package compiled in, the handling of sender and recipient addresses is modified.
The location of this database is controlled with the UserDatabaseSpec option.
The database is a sorted (btree-based) structure. User records
are stored with the key:
user-name:field-name
The sorted database format ensures that user records are clustered together. Meta-information is always stored with a leading colon.
Field names define both the syntax and semantics of the value. Defined fields include:
maildrop
mailname
When the rewriting rules submit an address to the local mailer, the user name is passed through the alias file. If no alias is found (or if the alias points back to the same address), the name (with :maildrop appended) is then used as a key in the user database. If no match occurs (or if the maildrop points at the same address), forwarding is tried.
If the first token of the user name returned by ruleset 0 is an at sign (@), the user database lookup is skipped. The intent is that the user database will act as a set of defaults for a cluster; mail sent to a specific machine should ignore these defaults.
When mail is sent, the name of the sending user is looked up in
the database. If that user has a mailname
record, the
value of that record is used as their outgoing name. For example,
the following record would cause my outgoing mail to be sent as
Eric.Allman:
eric:mailname Eric.Allman@CS.Berkeley.EDU
If a maildrop
record is found for the user, but no
corresponding mailname
record exists, the record
:default:mailname
is consulted. If present, this is
the name of a host to override the local host. For example, in
the above case, it would be set to CS.Berkeley.EDU.
The effect is that anyone known in the database gets their
outgoing mail stamped as user@CS.Berkeley.EDU, but
people not listed in the database use the local hostname.
The user database is built from a text file using the makemap(1M) utility. The text file is a series of lines corresponding to userdb records; each line has a key and a value separated by white space. The key is always in the format described in ``User database semantics''. For example:
eric:maildropThis file is normally installed in a system directory; for example, it might be called /etc/userdb. To make the database version of the map, run the program:
Then create a config file that uses this. For example, using the V8 M4 configuration, include the following line in your .mc file:
define(`confUSERDB_SPEC´, /etc/userdb.db)