Address direction and location-specific rewrites

From Messaging Server Technical Reference Wiki
Jump to: navigation, search


Address direction and location-specific rewrites, $B, $E, $F, $R

It is sometimes useful to specify rewrite rules that only apply to envelope addresses or, alternately, only apply to header addresses. The control sequence $E forces a rewrite to fail if the address being rewritten is not an envelope address. The control sequence $B forces a rewrite to fail if the address being rewritten is not from the message header or body. These sequences have no other effects on the rewrite and may appear anywhere in the rewrite rule template.

Addresses may also be categorized by direction. A forward-pointing address is an envelope To address or an address that originates on a To:, Cc:, Resent-To:, or other header line that refers to a destination. A backwards-pointing address is an envelope From address or an address from a header line such as From:, Sender:, or Resent-From:, referring to a source. The control sequence $F causes the rewrite to fail if the address is backwards-pointing. The control sequence $R causes the rewrite to fail if the address is forward-pointing.

The first of the following rewrite rules causes forward pointing envelope addresses (i.e., envelope To addresses) of the form user@oldhost.domain.com to be rewritten to user@newhost.domain.com and the message routed to the tcp_intranet channel:


oldhost.domain.com     $U%newhost.domain.com@tcp_intranet-daemon$E$F
oldhost.domain.com     $U@domain.com

All other, non-envelope-To occurrences, of addresses of the form user@oldhost.domain.com are rewritten to user@domain.com by the second rewrite rule.


See also: