|
Address
mappings, or "virtmaps," are similar to aliases
but are tailored to virtual domain names. Virtual Servers
that have one or more domain names associated with them
in addition to their primary domain name use virtmaps
to organize their aliases.
Aliases do not incorporate
information about the hostname portion of an e-mail
address, just the username portion. As a result, conflicts
occur when two virtual domains have e-mail addresses
with identical usernames, such as "webmaster".
Virtual e-mail address mappings are designed to avoid
these conflicts by ensuring that mail sent to "webmaster@domain1.com"
and mail sent to "webmaster@domain2.com" do
not collide, even though both domain names ("domain1.com"
and "domain2.com") are associated with the
same Virtual Server.
Creating a Simple Address
Mapping
- From your Virtual Server ~/etc/virtmaps file, type:
address recipient
where address
is replaced with the full address you would like
to route to and recipient is replaced
with the recipient address.
- From the command-prompt,
enter vnewvirtmaps. This action recreates the
~/etc/virtmaps.db file so the changes take
effect.
A Sample virtmaps File
In the following sample
virtmaps file, the address mappings are grouped
together by domain name. The first address mapping in
the "abc.com" group is redirecting mail to
a non-local user. The second address mapping is directing
mail to a local user.
#abc.com
mappings
bob@abc.com bob@aol.com
webmaster@abc.com carol
#xyz.com
mappings
bob@xyz.com bob
webmaster@xyz.com john
Note: Unlike the
~/etc/aliases file, there is no colon character
between the address and the recipient in the ~/etc/virtmaps
file.
Using Wildcard Mappings
A wildcard address mapping
serves as a "catch-all" that matches any address
at a hostname that is not already explicitly listed.
Creating Wildcard Mappings
- From your Virtual Server ~/etc/virtmaps file, type:
hostname recipient
where hostname
is replaced with the hostname you want to create
the wildcard for and recipient is
replaced with the recipient address.
- From the command-prompt,
enter vnewvirtmaps. This action recreates the
~/etc/virtmaps.db file so the changes take
effect.
Sample virtmaps File
with Wildcard Mappings
#abc.com
mappings
bob@abc.com bob@aol.com
webmaster@abc.com carol
abc.com carol
#xyz.com
mappings
bob@xyz.com bob
webmaster@xyz.com john
xyz.com bob
Note: You can
place wildcard mappings anywhere in the ~/etc/virtmaps
file. However, you should place them at the end of the
section, so that you emphasize their nature as a default
recipient (if none of the previous mappings match).
Combining Mappings and
Aliases
When a piece of new mail
arrives, address mappings are processed first, before
aliases are checked. Once the address mapping process
is complete and a local recipient has been determined,
the aliases database is checked next to see if the recipient
exists as an alias. If so, the message is routed to
the target of the alias. If not, the recipient must
exist as a local username, and a delivery attempt is
made to place the message in his or her incoming mailbox.
Differences Between
virtmaps and aliases
One difference between
the ~/etc/virtmaps and ~/etc/aliases files
is that multiple recipients must not be listed in a
single address mapping.
A related difference
lies in the fact that the right-hand portion of an ~/etc/virtmaps
line should consist solely of a recipient address and
must not contain any of the more advanced features.
Items such as :include: statements, delivery
to a file (signaled by a / character), or delivery
to a program (signaled by a | character) may
not be used in the virtmaps file.
Perhaps the most important
difference between virtmaps and aliases
is that sendmail performs only a single database
lookup in the ~/etc/virtmaps.db file when handling
address mappings. The net effect of this is that the
right-hand portion of an ~/etc/virtmaps line
(the recipient portion) must not depend on the left-hand
portion (the address portion) of any other line. The
sendmail program does not lookup further mappings
to trace recipient addresses (unlike alias processing
where sendmail performs repeated alias
lookups until it completely resolves the recipient address).
Virtmaps Summarized
- If you have only
one domain pointing to your Virtual Server, then use
of the virtmaps file is not necessary.
- Address maps are
stored in the ~/etc/virtmaps file.
- After adding an address
map to the virtmaps file, regenerate the virtmaps.db
file with the vnewvirtmaps command.
- Address maps follow
a simple format:
address
recipient
For
example:
webmaster@abc.com john
- No colons in address
maps and only one user on the right side. If multiple
recipients are needed on the right, then specify the
name of an alias on the right hand side, and then
create the alias in the aliases file with the
multiple recipients.
- The catch-all for
a domain should be last.
|