Sun Java System Messaging Server 6.3 Administration Guide

11.9 Rewrite Rules Example

The following example provides sample rewrite rules and how sample addresses would be rewritten by the rules.

Suppose the configuration file for the system SC.CS.SIROE.EDU contained the rewrite rules shown in the following example:

sc                     $
sc1                    $
sc2                    $
*                      $U%$&
*.cs                   $U%$&
*.cs.siroe             $U%$&
*         $U%$&        $U@$D       $U@$D       $U@$D        $             $U%$
.edu                   $U@$H$
[]                     $U@[$L]

Table 11–7 shows some sample addresses and how they would be rewritten and routed according to the rewrite rules.

Table 11–7 Sample Addresses and Rewrites

Initial address 

Rewritten as 

Routed to 









user@sc2.cs.siroe—route inserted— route inserted 


user@[]—route inserted 

Basically, what these rewrite rules say is: If the host name is one of our short-form names (sc, sc1 or sc2) or if it is one of our full names (, and so on), expand it to our full name and route it to us. Append to one part short-form names and try again. Convert one part followed by .cs to one part followed by and try again. Also convert .cs.siroe to and try again.

If the name is (some system we connect to directly, perhaps) rewrite and route it there. If the host name is anything else in the subdomain, route it to (the gateway for the subdomain). If the host name is anything else in the subdomain route it to (the gateway for the subdomain). If the host name is anything else in the .edu top-level domain route it to (which is presumably capable of routing the message to its proper destination). If a domain literal is used send it to as well.

Most applications of rewrite rules (like the previous example) will not change the username (or mailbox) part of the address in any way. The ability to change the username part of the address is used when the MTA is used to interface to mailers that do not conform to RFC 822—mailers where it is necessary to stuff portions of the host/domain specification into the username part of the address. This capability should be used with great care if it is used at all.