procmail
[Top] [All Lists]

Re: Can't get procmail to run from .forward file

2000-11-21 13:30:40
At 19:33 2000-11-21 +0100, Andreas Tindlund wrote:
The reason I used FROM_DAEMON is that I read that if I was forwarding
mail, and if some error message would occur, this message would loop and
loop for ever and screw up the entire system. FROM_DAEMON was supposed to

Properly forwarding mail requires that you implement a loop detection system. Commonly, this is identified by the X-Loop header.

# if you find a message with X-Loop header that includes your address
# (which only needs to be one token across all of the addresses handled
# by this account, not the individual ones), then toss it immediatley into
# a looped mail folder.
:0
* ^X-Loop: youraddr
loopedmail

# blindly add an X-Loop to *ALL* incoming mail.  Not really the proper way
# to do it, but if you do many forwards, this will simplify things.
# This is a FILTER - so the action takes place, but the message continues to
# be processed.
:0fh
|formail -A "X-Loop: youraddr"

(rest of filters)

If you hocked the above two recipes at the top of your recipes (after basic config, but before delivery recipes), most of the rest of your rules wouldn't need any changes. Of course, stored mail would have X-Loops that weren't part of the delivered messages, which isn't a good thing.

More appropriatley, each forward can do the following:

# matched on some criteria which we will forward on.
:0
* ^somecriteria
{
        # oh damn, our loop marker is already present -- this is a mail loop.
        # this delivers the message to a loop folder, and completes delivery
        # right here.
        :0:
        * ^X-Loop: youraddr
        loopedmail

        # add the loop header
        :0fh
        | formail -A "X-Loop: youraddr"

        # and forward the message
        :0
        !forwardaddr
}

This could be crunched down, and the forward could be handled directly through piping the output of formail into sendmail with the correct options (sans the 'fh' flags), but this rolls it out to the component actions, which may be easier to interpret and maintain.

filter away all error messagees before they where forwarded. I didn't know
that this command also triggered on mailing lists...

Thus the importance of checking the man pages before using things and when you have unexpected results.

---
 Please DO NOT carbon me on list replies.  I'll get my copy from the list.

 Sean B. Straw / Professional Software Engineering
 Post Box 2395 / San Rafael, CA  94912-2395

_______________________________________________
procmail mailing list
procmail(_at_)lists(_dot_)RWTH-Aachen(_dot_)DE
http://MailMan.RWTH-Aachen.DE/mailman/listinfo/procmail

<Prev in Thread] Current Thread [Next in Thread>