virtusertable is a database that maps virtual
(possibly nonexistent) domains into new addresses. Essentially, it
gives you a database hook into the early part of the
parse rule set 0. Note that this only reroutes
delivery. It does not change mail headers.
By way of example, consider one mapping in a source text file:
firstname.lastname@example.org bob email@example.com firstname.lastname@example.org email@example.com firstname.lastname@example.org @fictional.com email@example.com
The key portion (on the left) must be either a full address (user, host, and domain name), as in the first two lines, or an address without a host part (just a domain), as in the third line, or an address with the user part missing, as in the last line. This source text file is converted into a database with the makemap(1) program (Section 5.5).
The first three lines illustrate a full address for the key. The first line will be delivered to a local user (bob), the second and third to a remote user (firstname.lastname@example.org). The fourth line shows how all mail to a virtual domain (fictional.com) can be delivered to a single address, regardless of the user part.
Note that sendmail does multiple lookups, so one line can reference another. The following, for example, will work:
email@example.com firstname.lastname@example.org @fictional.com email@example.com
Here, mail to firstname.lastname@example.org will be delivered to email@example.com.
Also note that virtual hosts, just like real hosts, need to belong to
w ($=w ...