procmail
[Top] [All Lists]

Re: Forward Receipe

1997-12-21 01:33:17
On Sat, 20 Dec 1997, Thomas Trueten wrote:

i've to forward incoming messages from contact(_at_)address to 
some(_at_)address and to 
other(_at_)address(_dot_)
The replyto address in these forwarded messages has to be 
contact(_at_)address(_dot_) 
I need a copy of messages from contact(_at_)address too.

:0 c
* !^TO*contact(_at_)address
* !^X-Loop: contact(_at_)address
| $SENDMAIL -oi -t \
! some(_at_)address other(_at_)address

There is no test for "From: contact(_at_)address", and that puzzles me, but I
take it that contact(_at_)address is not the account this recipe resides on. 
The real problem is that in the action line, you are misusing "!" which is
a token for sendmail in action lines, but it can only be used as the first
character in the action line. Also the -t flag on sendmail would add all
the explicit recipients in the mail to the recipient list. I think this is
what you want:

        :0 c
        * ^From:.*\<contact(_at_)address\>
        * ! ^X-Loop:.*\<contact(_at_)address\>
        | formail -A"X-Loop: contact(_at_)address" \
        | $SENDMAIL -oi some(_at_)address other(_at_)address

Formail adds the X-Loop: field we are testing for in the second condition,
in case it bounces back. Sendmail mails it to the listed recipients. And
the "c" flag at the top ensures the original continues through procmail
for ultimate delivery.  make sure PATH includes a path to formail, or use
the pathname in the recipe. Formail's pathname is usually
/usr/local/bin/formail. 

David Hunt


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