Destination channel-specific rewrites

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


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 rules and 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 $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.

$Qchannelcauses 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 tcp_local channel. Then, to prevent "raw" user@host.bitnet style addresses from appearing on messages queued to that channel, a rewrite rule of the form


.BITNET       $U$%$H$D@interbit.cren.net$Qtcp_local 

might be used. This will, in messages destined to the tcp_local channel, transform addresses of the form user@host.bitnet to user%host.bitnet@interbit.cren.net.


See also: