Sun Java System Messaging Server 6 2005Q4 Administration Guide

Rewrite Rule Templates

The following sections describe in more detail template formats for rewrite rules. Table 11–2 summarizes the template formats.

Table 11–2 Summary of Template Formats for Rewrite Rules

Template 

Usage 

A%B 

A becomes the new user/mailbox name, B becomes the new host/domain specification, rewrite again. Repeated Rewrites Template, A%B

A@B 

Treated as A%B@B. Ordinary Rewriting Templates, A%B@C or A@B

A%B@C 

A becomes the new user/mailbox name, B becomes the new host/domain specification, route to the channel associated with the host C. Ordinary Rewriting Templates, A%B@C or A@B

A@B@C 

Treated as A@B@C@C. Specified Route Rewriting Templates, A@B@C@D or A@B@C

A@B@C@D 

A becomes the new user/mailbox name, B becomes the new host/domain specification, insert C as a source route, route to the channel associated with the host D. Specified Route Rewriting Templates, A@B@C@D or A@B@C

Ordinary Rewriting Templates, A%B@C or A@B

The following template is the most common form of template. The rule is applied to the user part of the address and to the domain part of the address. The new address is then used to route the message to a specific channel (indicated by ChannelTag).

UserTemplate%DomainTemplate@ChannelTag[controls]

The next form of template is identical in application to the most common form of template. However, this form of template is possible only if DomainTemplate and ChannelTag are identical.

UserTemplate@ChannelTag[controls]

Repeated Rewrites Template, A%B

The following template format is used for meta-rules that require additional rewriting after application of the rule. After the rule is applied, the entire rewriting process is repeated on the resulting new address. (All other rewrite rule formats cause the rewriting process to terminate after the rule has been applied.)

UserTemplate%DomainTemplate[controls]

For example, the following rule has the effect of removing all occurrences of the .removable domain from the ends of addresses:

.removable $U%$H

Extreme care must be taken when using these repeating rules; careless use can create a “rules loop.” For this reason meta-rules should only be used when absolutely necessary. Be sure to test meta-rules with the imsimta test -rewrite command. For more information on the test -rewrite command, see the Sun Java System Messaging Server 6 2005Q4 Administration Reference.

Specified Route Rewriting Templates, A@B@C@D or A@B@C

The following template format works in the same way as the more common template UserTemplate%DomainTemplate@ChannelTag (note the difference in the first separator character), except that ChannelTag is inserted into the address as a source route. The message is then routed to ChannelTag:

UserTemplate@DomainTemplate@Source-Route
    @ChannelTag[controls]

The rewritten address becomes @route:user@domain. The following template is also valid:

UserTemplate@DomainTemplate@ChannelTag[controls]

For example, the following rule rewrites the address jdoe@com1 into the source-routed address @siroe.com:jdoe@com1. The channel tag becomes siroe.com:

com1 $U@com1@siroe.com

Case Sensitivity in Rewrite Rule Templates

Unlike the patterns in rewrite rules, character case in templates is preserved. This is necessary when using rewrite rules to provide an interface to a mail system that is sensitive to character case. Note that substitution sequences like $U and $D that substitute material extracted from addresses also preserve the original case of characters.

When it is desirable to force substituted material to use a particular case, for example, to force mailboxes to lowercase on UNIX systems, special substitution sequences can be used in templates to force substituted material to the desired case. Specifically, $\ forces subsequent substituted material into lower case, $^ forces subsequent substituted material into upper case, and $_ says to use the original case.

For example, you can use the following rule to force mailboxes to lowercase for unix.siroe.com addresses:

unix.siroe.com    $\$U$_%unix.siroe.com