procmail
[Top] [All Lists]

Re: mail forwarding

1997-04-07 15:52:00
On Mon, 7 Apr 1997, Paul Keller wrote:

So, instead of saying,
Subject: Expense Report
   the subject going to the assistant would say,
Subject: < forwarded > Expense Report

Capture the subject into a var using SUBJECT=`formail -zx"Subject:"`
Then using formail again, but in a piping recipe this time, modify the
subject line using the "-I" flag. You might also want to add an
"X-Loop:" field to both forwards and then use that to prevent
previously forwarded mail from looping back through the recipe. 

Example:

        SUBJECT=`formail -zx"Subject:"`

        :0cw
        * ^TO_user(_at_)somesite(_dot_)com
        * !^X-Loop: [your address]
        | formail -I"X-Loop: [your address]" \
        | $SENDMAIL [forward address]

        :0aw
        | formail \
        -I"X-Loop: [your address]" \
        -I"Subject: (FWD) $SUBJECT" \
        | $SENDMAIL [assistant's address]

David <dnhunt(_at_)rain(_dot_)org>


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