38.6. Managing Virtual Mappings

Qmail can be configured to treat email to the same mailbox at different domains differently, so that [email protected] and [email protected] are not delivered to the same user or alias. This is vital if you are hosting multiple mail domains, as there are certain to be clashing mailbox names (like sales or webmaster) in several of them. Creating an alias that only applies to a certain domain, rather than to all domains, accomplishes this because the aliases created by following the instructions in Section 38.4 “Managing Email Aliases” do.

Before you can add domain-specific aliases, Qmail must first be configured to treat the domain specially. It adds a suffix like example- or foo-internally to the To: address of any email sent to the domain, so that you can create aliases like example-sales or foo-sales. Fortunately, Webmin does most of the work of adding these prefixes for you where appropriate.

To designate a domain as special for aliases, follow these steps:

1.
On the module's main page, click on the Virtual Mappings icon. A page listing all existing domains and their prefixes will be displayed, with a form at the top for adding a new one.

2.
In the Mail for address field, select Addresses with domain and enter the domain name (like example.com) into the text box next to it.

If the Any address not matching another virtual mapping option is chosen, the suffix entered in the next step will be added to all To: addresses that do not match another virtual domain. This is not normally very useful.

If Address is selected and a mailbox name and domain is entered into the two text fields next to it, the mapping will apply only to that specific address. The suffix will be prepended to the username part of the address, for example, transforming [email protected] to [email protected]. This is less useful than mapping an entire domain, but can be done to give the user fred the ability to create personal .qmail files for different domains.

3.
In the Prepend to username field, it is simplest to leave Automatically chosen prefix selected. This tells the module to take the first part of the domain name (like example in the case of example.com) as the prefix, which almost always works fine.

If you prefer to select your own prefix, choose the Specified prefix option and enter it into the adjacent text box. It should consist of only letters, numbers, and the character. If you enter a UNIX username as the prefix, mail to the domain will be effected by the .qmail- files in his home directory. For example, if the prefix is bob and email is received for [email protected], then ~bob/.qmail-fred will control where it is forwarded to.

If Nothing is chosen, no prefix will be added for the domain at all. This can be useful if a parent domain has virtual mapping enabled.

4.
Hit the Create button to add the new virtual domain mapping to the list.

5.
Go back to the main page, and click on the Local Domains icon.

6.
Remove the domain you have just added from the list. Otherwise, any email to it will be delivered normally as though the virtual mapping did not exist.

7.
Click Save to update the local domains list.

As is usual in Webmin, you can edit or delete a virtual mapping after it has been created by clicking on the domain name on the list in the Virtual Mappings page. Change any of the fields and click Save to activate the new prefix, or hit the Delete button to remove it altogether. Be careful changing the prefix or deleting a mapping, as any existing aliases that use that prefix will not be updated and thus will stop working.

Once you have configured Qmail to perform virtual mapping for a domain, you can add aliases that are specific to it. To do this, follow the instructions in Section 38.4 “Managing Email Aliases”, but select the domain that the alias should be in from the menu in Step 2. After it has been added, the alias will appear in the list with its prefix—like example-sales—rather than as the actual address that it really matches, like [email protected].

Be aware that an alias that is not specific to any domain will not apply to email sent to that mailbox name at other domains. This is unlike the behavior of Sendmail aliases, and can be confusing if you have just added a virtual mapping for a domain and are wondering why all your old aliases have stopped working.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
18.222.83.185