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:
email@example.com bob firstname.lastname@example.org email@example.com firstname.lastname@example.org email@example.com @fictional.com firstname.lastname@example.org
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 (email@example.com). 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:
firstname.lastname@example.org email@example.com @fictional.com firstname.lastname@example.org
Here, mail to email@example.com will be delivered to firstname.lastname@example.org.
Also note that virtual hosts, just like real hosts, need to belong to
w ($=w ...