Forwarding mail

The term alias often encompasses two separate types of functionality: address routing (which inherently relates specifically to envelope To addresses), and cosmetic changes to other instances of addresses (envelope From addresses, and header addresses). The cosmetic changes of address reversal do not apply per se to envelope To addresses. Rather, envelope To addresses are continuously rewritten and modified as messages proceed through the  mail system. The entire goal of mail routing is to convert envelope To addresses to increasingly system and mailbox-specific formats. The canonicalization functions of address reversal are entirely  inappropriate for envelope To addresses.

In addition to the transformations of domain names available via rewrite rules and domain aliases, which are generally (though not necessarily) applied to all addresses in the domain, including instances of envelope To addresses, envelope To addresses may also be modified on a per-user basis via one or more mechanisms of mail forwarding.

The MTA provides several mechanisms for forwarding mail. The method appropriate to a task at hand depends upon the scope of the forwarding:



 Forwarding mail for selected users. To forward mail for   selected users, it is best to use aliases. You may also use aliases to   accept mail for a non-existent user and forward it on to one or more    real users. See  Forwarding via user LDAP   attributes, and   alias options. 

 Forwarding mail to a list of users. Aliases are also used   to create mailing lists. 

 Forwarding mail for selected users in other than the local   domain. To forward mail for selected users in an arbitrary domain    (a domain other than the local channel name), the best approach may depend on   how the users are provisioned. For users provisioned via   alias options, use of a rewrite rule    matching the domain to the local channel and alias lookups that include    the domain name and that have a fall-through entry (see the      MTA option) may    be appropriate. For users provisioned in LDAP, in the general case,  modifying those users&#x27;   LDAP entries to have    appropriate LDAP attributes   for forwarding is most explicit. 

 Pattern-matching the users for forwarding. In the special    case where   a set of users whose mail is to be forwarded can be detected via simple    string pattern matching, and where the forwarding to be performed requires   only a simple string transformation, use of a domain catchall mapping on    an LDAP-provisioned domain may be convenient; see the          MTA option. 

 Forwarding all mail for a given host to another host. In   this case there are several approaches. The most efficient method   requires that you be able to blindly change      into      without any conflict in    user names; i.e., not have to worry that the username    " " on old-host conflicts with a    different person on   who has the same    username. When this is the case, simple MTA   rewrite rules may be used. The less efficient, but just as   effective, approaches involve using either a      mapping table,     forward database,    or alias lookups. Or for domains provisioned in  LDAP, in some cases use of domain-level LDAP attributes may be    appropriate: see the      MTA option (LDAP attribute  ) and     MTA option (LDAP attribute  ). 

 Complicated rule-based forwarding. For performing complicated, rule-based forwarding, use of a Sieve filter to perform   Sieve " " actions  allows for great flexibility; such a Sieve filter may be configured at  various levels, including   domain-level or user-level. 



The MTA&#x27;s forward database and/or   mapping table, and domain catchall mapping tables (see the     MTA option) may be used for special sorts of forwarding purposes, such as pattern based  forwarding, source-specific forwarding, or "autoregistration"  of addresses. Note that the forward database and   mapping table, as well as domain catchall mappings, are  intended for use primarily for these special sorts of address  forwarding; most sorts of address forwarding, however, are better  performed using one of the MTA&#x27;s other forwarding mechanisms.

See also:
 * Address reversal
 * Forwarding via user LDAP attributes
 * Alias options
 * Mailing lists
 * FORWARD mapping table
 * Forward database
 * ldap_domain_attr_smarthost MTA Option
 * ldap_domain_attr_routing_hosts MTA Option
 * ldap_domain_attr_catchall_mapping MTA Option
 * Sieve redirect action
 * Sieve hierarchy
 * Aliases