Aliasing is the process of converting one local recipient name on the system into another and Aliasing occurs only on local names. Which means, the
username must be available via getpwnam from the password database:
e.g., the local password file /etc/passwd, NIS, and LDAP.
virtusertable feature enables support for the virtual users, meaning it maps non-system users.
I have quoted the following from here. Very well explained, please have look.
This database file contains a list of virtual mailboxes that are
expanded to users, files, programs, or other aliases. Here are a few
entries to illustrate the file format:
The mailbox name on the left side of the colon is expanded to the
target(s) on the right. The first entry expands the root mailbox to
the localuser mailbox, which is then looked up in the
/etc/mail/aliases database. If no match is found, the message is
delivered to localuser. The second entry shows a mail list. Mail to
ftp-bugs is expanded to the three local mailboxes joe, eric, and paul.
A remote mailbox could be specified as email@example.com. The third
entry shows how to write mail to a file, in this case /dev/null. The
last entry demonstrates how to send mail to a program,
/usr/local/bin/procmail, through a UNIX® pipe. Refer to aliases(5) for
more information about the format of this file.
This database file maps mail addresses for virtual domains and users
to real mailboxes. These mailboxes can be local, remote, aliases
defined in /etc/mail/aliases, or files. This allows multiple virtual
domains to be hosted on one machine.
The following example demonstrates how to create custom entries using
This file is processed in a first match order. When an email address
matches the address on the left, it is mapped to the local
mailbox listed on the right. The format of the first entry in this
example maps a specific email address to a local mailbox, whereas the
format of the second entry maps a specific email address to a remote
mailbox. Finally, any email address from example.com which has not
matched any of the previous entries will match the last mapping and be
sent to the local mailbox joe.
Now a little more detailed answers to your questions:
- The aliases database file contains a list of virtual mailboxes that are expanded to users, files, programs, or other aliases.
- This virtuser database file maps mail addresses for virtual domains and users to real mailboxes. These mailboxes can be local, remote, aliases defined in /etc/mail/aliases, or files. This allows multiple virtual domains to be hosted on one machine.
- The sendmail virtusertable feature on the other hand configure support for the virtual user table. The virtual user table maps incoming mail destined for someuser@host to someotheruser@otherhost. One can think of this as an advanced mail alias feature, one that operates using not just the destination user, but also the destination domain. The key portion (on the left) must be either a full address (user, host, and domain name), or an address without a host part (just a domain).