Previous | Contents | Index |
Once a host/domain specification matches a rewrite rule, it is rewritten using the template part of the rule. The template specifies three things:
A summary of the template formats for rewrite rules is presented in Table 2-2. The substitution strings and control sequences which may be used with templates are discussed in Section 2.2.6.
Template | Section | Usage |
---|---|---|
A%B | 2.2.5.2 | A becomes the new user/mailbox name, B becomes the new host/domain specification, rewrite again |
A@B | 2.2.5.1 | Treated as A%B@B |
A%B@C | 2.2.5.1 | A becomes the new user/mailbox name, B becomes the new host/domain specification, route to C |
A@B@C | 2.2.5.3 | Treated as A@B@C@C. |
A@B@C@D | 2.2.5.3 | A becomes the new user/mailbox name, B becomes the new host/domain specification, insert C as a source route, route to D |
2.2.5.1 Ordinary Rewriting Templates, A@B or A%B@C
The most commonly used form of rewrite rule template is A%B@C, where A
is the new username, B is the new host/domain specification, and C is
the routing system (official channel name). If B and C are identical,
%B may be omitted; i.e., you may simply use A@C when B and C
are identical.
2.2.5.2 Repeated Rewritings Template, A%B
The special rewrite rule template format A%B is used for
"meta-rules" that require additional rewriting after their
application. When an A%B pattern is encountered, A becomes the new
username and B becomes the new host/domain specification, and then 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.
For example, the rule
.removeable $U%$H |
.removeable
domain from the ends of addresses.
Extreme care must be taken when using these repeating rules; careless use can create a "rules loop" that will hang PMDF in an infinite loop. For this reason meta-rules should only be used when absolutely necessary. Be sure to test them with the OpenVMS command PMDF TEST/REWRITE or the UNIX or NT command pmdf test -rewrite
.
2.2.5.3 Specified Route Rewriting Templates, A@B@C or A@B@C@D
The special rewrite rule template format A@B@C works in the same way as
the usual A%B@C rule, except that the routing system C will also be
inserted into the address as a source route. This inclusion of the
routing system in the address may be needed by some channels that have
to establish a connection to the routing system and determine the name
of the routing system from the envelope To: address. For instance, the
rewrite rule
vax1 $U@vax1@example.com |
The template format A@B@C@D uses A as the new username, B is the new host/domain specification, C is inserted as a source route, and D is the routing system. This is the most general template format available.
Channel table rewriting may change the name of the routing system if the address being rewritten is an envelope To: address. See Section 2.3.3 for further information on channel table rewriting. |
2.2.5.4 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 such as UUCP which 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 instance, to force mailboxes to lowercase on UNIX systems, special substitution sequences can be used in templates to force substituted material to a desired case. Specifically, $\ forces subsequent substituted material into lower case, $^ forces subsequent substituted material into upper case, and $_ says to use the original case. So you can use a rule such as
unix.example.com $\$U$_%unix.example.com |
Previous | Next | Contents | Index |