To Gain Knowledge and to become a one, who all wants to become

Dreams are not those which are seen during sleep ,but Dreams are those which do not let you sleep,so see the dreams
and work hard to make them true.

Friday, July 30, 2010

virtusertable based domain routing

Incoming E-mail messages can be sorted based on the recipient domain name with the virtusertable utility. Because user accounts are not directly associated with any specific domain names, a virtusertable must be used to differentiate between recipient domain names. For example, a virtusertable mapping will allow you to direct E-mail messages for and to different users on your VPS v2.

Configuring Virtusertable mappings

In order to create virtusertable mappings, you must first create a text file in the /etc/mail/ directory of your server (there is a sample file in that directory named virtusertable.sample). This file will contain virtusertable mappings.

Each entry in a virtusertable should be on a single line. The original recipient address on the left hand side, with one or more spaces or tabs separating it from the right hand side, which contains the destination address. Using the example above, the virtusertable mapping would be as follows:     tom steve

The original recipient is the E-mail address that people will send messages to, and can be either a full address (, or a catch all for all messages to the specified domain ( If you want to create multiple virtusertable entries for a single domain, make sure that you put the catch all below any other entries for that same domain name. For example:    tom john john

The destination address should be a local user, an alias, or a remote E-mail address. You may also use a %1 to indicate that the original user should be prepended to a catch all.

Any time you make a change to the /etc/mail/virtusertable text file, you will need to create a db file that sendmail can read. The following command will create the /etc/mail/virtusertable.db file when run by root:

# makemap hash /etc/mail/virtusertable < /etc/mail/virtusertable

Alternatively, a shorter version of this same command can be used:

# vnewvirtmaps

Example Virtusertable Entries

The following entry would deliver any message sent to to the local account floydr.		floydr

The next entry will deliver a message sent to to his personal E-mail account with his ISP.

Any other E-mail sent to the domain will go to Floyd's local account.			floydr

Anything sent to a user at will be sent to, but will not change the username the message was originally sent to (only the domain is modified).

The following entry will reject mail addressed to any address at the domain that is not defined in the virtusertable file. The sender will receive an appropriate error code plus the description, "User unknown."			error:nouser User unknown

No comments:

Post a Comment