37.6. Managing Virtual Address Mappings

Address mappings are similar to aliases, except that they apply only to email sent to a specific user and domain, rather than to a user at any domain as aliases do. Another difference is that address mappings can only forward email to a single address, rather than to a program, file, or list of addresses. This limitation, however, can be overcome by combining both mappings and aliases.

You can use address mappings to send email to [email protected] and [email protected] to different final destinations, even though your server hosts both domains. This is particularly useful if you manage a large number of email domains for different customers, many of whom want to have similar addresses (such as sales) in their domains.

Address mappings can also be used to redirect all email to a particular domain to the same users at a different domain, so that mail to [email protected] and [email protected] will be sent to [email protected] and [email protected], respectively. Better still, you can have all email to any address at a domain sent to another single address, which is useful for the POP3 mail client Fetchmail that is explained in Chapter 33.

To create a new address mapping, follow these steps:

1.
On the module's main page, click on the Address Mappings icon. A page listing all existing mappings will be displayed, with a form at the top labeled Create Mapping for adding a new one.

2.
If you want to create a mapping for email to just a single address, select Address in the Mail for field, and enter the address into the adjacent text box. Unlike an alias, it must be entered in full like [email protected].

If you are creating a mapping for all email to a domain, select the Domain option and enter the complete domain or hostname into the text field next to it, such as example.com.

Either way, the domain in the address or the entered domain must appear in Sendmail's list of local domains, explained in the “Editing Local Domains” section earlier in this chapter.

3.
If the destination of the mapping is a single address, select Address in the Send to field and fill in the text box next to it with either a complete address (like [email protected]) or a mailbox name (like just jcameron).

If Domain was selected for the Mail for field, you are allowed to select the Domain option for this field as well. If so, you must enter a domain name (like foo.com) into the adjacent text box, to which all email sent to the original domain will be forwarded.

The final Return error option in the Send to field can be selected if you want a specific error message to be returned to senders. If chosen, an error type must be selected from the menu next to it, and a more detailed error message entered into the text box. This option can be useful for sending back bounce messages that explain why a particular address or entire domain is no longer reachable.

4.
Click the Create button to add the address mapping to the list of those shown below the form. It will be made immediately active.

As with aliases, you can edit or delete existing mappings by clicking on their addresses in the list. This will bring up a form identical to the one used for creating a mapping, but with Save and Delete buttons at the bottom.

If a mapping exists for both a domain and an address in that domain, Sendmail will use the second for email to that specific address, and the first for email to any other mailbox in the domain. In effect, more specific address mappings take precedence over those that are more general. Their ordering in the list on the Address Mappings page does not matter at all.

If you want to create a mapping that forwards email to a program, file, or list of addresses, you will need to create an alias as well. The address mapping will send email to the alias, and then the alias will forward it on to the real destination. The alias should assign a name that is related to the address mapping, such as jcameron-example-com for mapping for the virtual address [email protected].

On a system with many domains and users, it is quite likely that two people will want to have the same mailbox name in different domains, such as [email protected] and [email protected]. Because Sendmail ultimately only delivers email to UNIX users' mail files, and two UNIX users cannot have the same name, this can be a problem. The usual solution is to create users named like bob-foo and bob-bar, and set up appropriate address mappings to forward email to them. The only downside is that the users will need to log in to the POP3 server as bob-foo or bob-bar instead of just bob.

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

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