procmail
[Top] [All Lists]

Re: Capture MATCH?

2001-07-17 00:42:12
Thanks for the feedback.  See below:

At 01:55 PM 7/16/2001 -0700, you wrote:

I don't follow the logic that you cannot perform variable assignment. As for making a script and piping it through, see below..

I think by using the work "obvious" I sounded arrogant, but was trying to imply that I obviously did not know how to do it. The "Obvious" part to me was simply that trying to do assignment at that point in the recipe was failing. In this case I was saying that I tried it and procmail choked. In the sample I submitted, procmail attempts to deliver to the "USER=XYZ(_at_)externalserver(_dot_)mysite(_dot_)org", so I jumped the quick conclusion that it was interpreting it as an action.

Note that your TO: line may have MULTIPLE addresses on it... what you're doing is at least ensuring that the TO: includes an address at externalserver.mysite.org. To: may also include plaintext name text, not just raw addresses.

This is a brilliant point that will no doubt save me an embarrassment later. I had never considered an inbound email to more than one internal address.



Check docs for MATCH - it doesn't work by stopping at the specified text - it assigns the match from the beginning of the match to EOL.

Valuable information.  Explains why I had too much in \/.

Which is why you'd pipe the match through sed or something like that. An example:

USERID|=echo $MATCH|sed -e 's/@externalserver.mysite.org/@internalserver.mysite.org/g'

This I can work with.  .

What gives with the pipe and forward.  Doesn't this upchuck errors at you?

This has never been tested, but I see you point, indeed, should be another :0 (I through together the example to illustrate my frustrations getting a variable assigned from MATCH in a recipe.

Here is a revised pass:

:0BH
 * ^To: \/(_dot_)*(_at_)externalserver(_dot_)mysite(_dot_)org
USER|=echo $MATCH|sed -e 's/@externalserver.mysite.org/@internalserver.mysite.org/g'
 * ^Content-(Type|Disposition):.*name=.*\.\/(exe|com|zip|vbs|shs|hta|scr|chm)
 {
        :0f
        | formail -I "X-VIRUSWARNING: This file had a $MATCH attachment"
        :0
        ! $USER
 }

Unfortunately I still get a choke in the log:

procmail: Skipped "james(_at_)externalserver(_dot_)mysite(_dot_)org|sed -e s/@externalserver.mysite.org/@internalserver.mysite.org/g"
From james(_at_)kites(_dot_)org  Mon Jul 16 19:21:22 2001
 Subject: test
  Folder: USER|=echo

It seems I am still unable to assign variables inside of a recipe......it still thinks it is an action. What am I missing in the simple assignment of a variable? Or, do I need to take the assignment out of the :0 all together?

Thanks again for the information.





James Ervin
james(_at_)kites(_dot_)org
http://www.kites.org

_______________________________________________
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>