The virtmaps feature of your Virtual Private Server allows you to create domain-based mappings to handle E-Mail for your Virtual Subhosted domains. This allows you to create common E-Mail aliases such as webmaster or abuse and handle them differently, based off the domain name the E-Mail is sent to. This is important because, without a virtmap, your Virtual Private Server's E-Mail program will treat all the local host names equally.

An example of when a virtmap would be useful is for the common webmaster alias. If you have two different Web sites on your Virtual Private Server, and they are being maintained by different people, you will want to have E-Mail sent to webmaster to be directed to the appropriate account. If no virtmap exists, all E-mail to webmaster at either domain will get delivered to the same user.

When incoming mail is recieved on your Virtual Private Server, the first step is to compare the domain name to the list of local host names or allowed relay domains. If the domain is listed in the ~/etc/local-host-names file on your Virtual Private Server, it is considered to be a local domain, and the E-Mail message is handed off to the virtmaps utility. Inside the virtmaps tool, the entire recipient address is compared to the addresses listed in your virtmaps table. If the recipient matches one of the entries on the left-hand column, the message gets delivered to the address listed on the right-hand side of that same row.

Virtmaps are stored in the ~/etc/virtmaps file on your Virtual Private Server. There are a few different types of virtmap entries you can create. The first kind is a remote mapping. This type of mapping will deliver the E-Mail to an off-site account. They will look similar to the following example:

my_user@local_host.com     accountname@my_isp.com

The second type of virtmap is a local mapping. This maps an E-Mail address to a local user or alias:

user_two@local_host.com     username

Finally comes a catchall virtmap. This will deliver any mail sent to the specified domain to a single E-Mail address. Any specific mappings for accounts on a domain with a catchall need to be listed before the catchall mapping in the virtmaps file. A catchall is indicated by putting only the domain name in the left-hand side of the row, and can be pointed at either a remote or a local addrress:

local_host.com     mylocaluser

Once you have created all the virtmap entries you need, you will need to update the virtmaps.db database file that sendmail uses. To do this, run the following command from your Virtual Private Server SSH or Telnet command prompt:

% vnewvirtmaps

To delete an existing virtmap, simply delete that line from the ~/etc/virtmaps file and run the vnewvirtmaps command again.

Please note: the information on this page applies to ITS web hosting plans. It may or may not apply to other environments. If you are looking for a feature described here, or better support from your hosting provider, please consider hosting your site with ITS!

1555 N Naperville/Wheaton Road, Suite 107
Naperville, IL 60563
phone 630.420.2550
fax 630.420.2771