Destination channel-specific rewrites
Destination channel-specific rewrites, $C, $Q
It is possible to have rewrite rules whose application is dependent upon the channel to which a message is being enqueued. This is useful when there are two names for some host, one known to one group of hosts and one known to another. By using different channels to send mail to each group, addresses can be rewritten to refer to the host under the name known to each group.
Destination channel-specific rewriting is associated with the channel to which a message is being enqueued and the channel options
norules on that channel. If
norules is specified on the destination channel, no channel-specific rewrite checking is done. If
rules is specified on the destination channel, channel-specific rule checks are enforced.
rules is the default.
Destination channel-specific rewriting is not associated with the channel a given address matches. It depends only on the message's envelope To address. When a message is enqueued, its envelope To address is first rewritten to determine to which channel the message will be enqueued. During the rewriting of the envelope To address any
$Q control sequences are ignored. Once the envelope To address is rewritten and the destination channel determined, then the
$Q control sequences are honored as other addresses associated with the message are rewritten.
Destination channel-specific rewrite checking is triggered by the presence of a
$Q control sequence in the template part of a rule. The characters following the
$Q, up until either an at sign,
@, percent sign,
%, or subsequent
$?, are interpreted as a channel name.
channelcauses the rule to fail if the channel
channel is not the destination.
channel causes the rule to fail if the channel
channel is the destination.
$C clauses may be specified. If any one of multiple
$Q clauses matches, the rule will succeed. If any of multiple
$C clauses matches, the rule will fail.
For example, suppose the local host's TCP/IP channel used to communicate with the Internet is the
tcp_local channel. Then, to prevent "raw" firstname.lastname@example.org style addresses from appearing on messages queued to that channel, a rewrite rule of the form
might be used. This will, in messages destined to the
tcp_local channel, transform addresses of the form email@example.com to firstname.lastname@example.org.