Rewrite apply specified mapping substitutions

Rewrite apply specified mapping substitutions, ,
A substitution of the form        is handled  specially. The   part is used to find and apply an MTA mapping table. The   field specifies the name of the mapping table to use while   specifies the string  to pass to the mapping. The mapping must exist and must set the  flag in its output if it is successful; if it doesn&#x27;t exist or doesn&#x27;t set  , then the rewrite will fail. If successful, the result of the mapping is merged into the template at the current location and reexpanded.

A substitution of the form     , where   is a non-zero bit-encoded value works in same way, except that one or more  -separated prefixes are added to the mapping probe. The available prefixes are:

If multiple bits are set the corresponding prefixes are added in numerical order with the least significant bit on the left.

The ability to call out to a mapping can be used to make up for the lack of flexibility in rewrite rule matching - which sacrifices flexibility for speed. For example, a rewrite rule that matches and blocks attempts to send to DHCP client host names that take the form "dhcp-&#x2a;.example.com" can be constructed using a mapping of the form: DHCP_MATCH dhcp-&#x2a;       $Y And a rewrite rule of the form: &#x2a;.example.com $E$F${DHCP_MATCH,$H}$?Cannot$ send$ to$ DHCP$ client This mechanism also allows the MTA&#x27;s rewriting process to be extended in complex ways. Substring matches on subdomains can be implemented and so can changes that cross subdomain boundaries. For example, suppose that domains of the form &#x2a;-subdomain.example.org are to be rewritten to &#x2a;.subdomain.example.org in both header and envelope addresses and routed to the tcp_local channel. This can be done with a table: DASH_TO_SUBDOMAIN &#x2a;-subdomain  $Y$0.subdomain And a rewrite rule of the form: &#x2a;.example.org  $U%${DASH_TO_SUBDOMAIN,$H}$D@TCP-DAEMON The username part of an address can also be be selectively analyzed and modified, either alone or in conjunction with the domain part. For example, the following table and rewrite rule removes enclosing single quotes from all addresses, modifying both the local part and domain: QUOTE_CHECK &#x27;&#x2a;@&#x2a;&#x27;        $Y$0%$1 $&#x2a;             ${QUOTE_CHECK,$U$@$H}

See also:
 * Mapping tables
 * Rewrite rule template substitutions and control sequences