PMDF System Manager's Guide


Previous Next Contents Index

2.2.6.15 Controlling Error Messages Associated with Rewriting, $?

PMDF provides default error messages when rewriting and channel matching fail. The ability to change these messages can be useful under certain circumstances. For example, if someone tries to send mail to an ethernet router box, it may be considered more informative to say something like "our routers cannot accept mail" rather than the usual "illegal host/domain specified". A special control sequence can be used to change the error message that will be printed if the rule fails. The sequence $? is used to specify an error message. Text following the $?, up until either an at sign, percent sign, $N, $M, $Q, $C, $T, or $? is taken to be the text of the error message to print if the result of this rewrite fails to match any channel. The setting of an error message is "sticky" and will last through the rewriting process.

A rule that contains a $? operates just like any other rule. The special case of a rule containing only a $? and nothing else receives special attention --- the rewriting process is terminated without changing the mailbox or host portions of the address and the host is looked up as-is in the channel table. This lookup is expected to fail and the error message will be returned as a result.

For instance, if the final rewrite rule in the PMDF configuration file is


.     $?Unrecognized address; contact postmaster@xyzzy.com 
 
then any unrecognized host/domain specifications which will fail will, in the process of failing, generate the error message Unrecognized address; contact postmaster@xyzzy.com.

There is an optional value that may be specified between the $ and the ?. This value tells PMDF what error number to use with the specified error message. The default if no value is specified is 5.1.2, a permanent error. You can use the optional value to specify a temporary error (4.y.z) or a different permanent error.

The value is formatted as follows: to get the error number x.y.z, the value between the $ and ? should be x00y00z. For example:


.     $4001002?Unrecognized address; contact postmaster@xyzzy.com 
 
Generates a 400-level error response with the error message 4.1.2 Unrecognized address; contact postmaster@xyzzy.com.


Previous Next Contents Index