# Determining Which Rule Trapped a Message

If a message is trapped by a rule, an X-IMail-Rule line is placed in the message header, to identify which rule caught the message. If multiple rules trap a message, only the last rule will be placed in the X-IMail-Rule line. The X-IMail-Rule line will also contain up to 30 characters of the message data that caused the message to be trapped. Message data will not be included in the X-IMail-Rule line when a message is trapped by a negative rule (does not contain or does not equal). The maximum length of any X-IMail-Rule line is 250 characters.

If a domain rule traps the message, the X-IMail-Rule line will be added to all local deliveries. If a message is trapped by a user's rule, the X-IMail-Rule line will only be added to deliveries to the user. When a message is trapped by an outbound rule, a line with the rule causing the trap will be written to the Queue file. When this message is delivered, and that line exists in the Queue file, it will be written as an X line in the message header.

Note: Because IMail Server inserts the rule and 30 characters of the message in the header, special care should be taken if a trapped message is then forwarded to another recipient. Some e-mail clients will include the header in the forwarded message. If this occurs and you have a rule set up to search the body of the message for the same text, then the message will be trapped again.

## Disabling the X-IMail-Rule Header

If you wish to disable the X-IMail-Rule header, so that it does not appear in the message header, you must add an entry to the registry. In the registry, go to HKEY_LOCAL_MACHINE\SOFTWARE\Ipswitch\IMail\Global and add the entry BlockRuleHdr with a non-zero value. This is s server wide setting and affects all domain and user rules on the server. If BlockRuleHdr is not present in the registry or is set to a value of zero, then the X-IMail-Rule header is enabled and will be displayed in the header of messages.