Sun Java System Messaging Server 6 2005Q4 MTA Developer's Reference

Preventing Mail Loops when Re-enqueuing Mail

This section shows how to add a new rewrite rule to prevent a message loop from happening if the program is doing intermediate processing that leaves the envelope recipient addresses unchanged. Otherwise, the channel would just enqueue the mail back to itself.

For discussion purposes, suppose that the channel is to provide intermediate processing for mail addressed to user@siroe.com. Further, the imta.cnf file has the following rewrite rule for siroe.com:

siroe.com $U@siroe.com

For example, as shown in the code example that follows, assume that the intermediate processing channel’s name is “xloop_test.” Near the bottom of the imta.cnf file with other channel definitions, you would see the following definition:


xloop_test
x-looptest-daemon

Then, as shown in the following example, a new rewrite rule for siroe.com needs to be added to the top of the imta.cnf file:


siroe.com $U%siroe.com@x-looptest-daemon$Nxloop_test
siroe.com $U@siroe.com

The new rewrite rule causes the following to happen: