"Tony L. Svanstrom" <[EMAIL PROTECTED]> writes:
> On Wed, 12 Jun 2002 the voices made [EMAIL PROTECTED] write:
>
>> My perl is very weak, so I wondered if someone could coach me a bit
>> on how to id the presence of `X-Spam-Status:' line including any
>> newlines that may be involved, and whether there is a space or the
>> string `none' after `tests='. I think its just a matter of using
>> perlre that include newlines, but having a problem finding how.
>
> Sounds like you're just dealing with a single header in your perl, so let
> procmail do the unfolding for you; like this example:
>
> :0
> * ^X-Spam-Status:[ ]*\/.*
> {
> MATCH=`perl -e '$ENV{"MATCH"} =~ s/exa/mple/i; print $ENV{"MATCH"}'`
> :0fh
> | formail -I "X-Spama-Status: $MATCH"
> }
Thanks Tony, this looks pretty handy here. But I'm still a little
confused how to use it in this application. Looks like what you are
demonstating is way to edit a header line and print the edited
version as a new header. Its close but not sure its what I'm trying
to do. Maybe my perl program goes in where your `perl -e' is. Not sure I
see how, but probably just overlooking the obvious.
Here is a little more detail of what I'm trying to do:
The line in question might look like:
X-Spam-Status: No, hits=1.0 required=5.0
tests=FROM_ENDS_IN_NUMS,SOME_RULE,OTHER_RULE
version=2.21
X-Some-more-Headers:
Below is what I want for processing:
tests=<THIS PART>version=2.21
It gets split and proecessed then is printed like:
X-Spama-Scores: D:FROM_ENDS_IN_NUMS:2.3 SOME_RULE:1.5 OTHER_RULE:2.4 T:6.2
So the original header remains unchanged and the new header is added
right below it.
So maybe something like this:
:0
* ^X-Spam-Status:[ ]*\/.*
{
MATCH=`my_script`
:0fh
| formail -I "X-Spama-Status: $MATCH"
}
So will `my_script' know what env{"MATCH"} is? I can use it like:
cat my_script
[...]
@some_array = env{"MATCH"};
for(@some_array){
carry out the processing
}
print $value_of_new_header"
_______________________________________________________________
Sponsored by:
ThinkGeek at http://www.ThinkGeek.com/
_______________________________________________
Spamassassin-talk mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/spamassassin-talk