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 keywords
norules on that channel. If
norules is specified on the destination channel, no
channel-specific rewrite checking is done. If
specified on the destination channel, channel-specific rule checks are
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 $C and $Q control sequences are ignored. Once the envelope To: address is rewritten and the destination channel determined, then the $C and $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 $C or $Q control sequence in the template part of a rule. The characters following the $C or $Q, up until either an at sign, percent sign, or subsequent $N, $M, $C, $Q, $T, or $? are interpreted as a channel name.
$Qchannel causes the rule to fail if the channel channel is not the destination. $Cchannel causes the rule to fail if the channel channel is the destination.
Multiple $Q and $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 ptcp_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