[plug] Procmail question

Trevor Phillips T.Phillips at murdoch.edu.au
Mon Aug 12 16:39:44 WST 2002


On Monday 12 August 2002 14:33, Anthony J. Breeds-Taurima wrote:
>
> Prolly something like:
> :0
>
> * ^From: tony at cantech.net.au
> {
>
> 	:0fw
> 	:
> 	| /usr/bin/perl -0 -pe 's/^(Subject:\s*)(.*)$/${1}FOO ${2}/s'
> 	|
> 	: <insert you IMAP deliver rule here>
>
> }
>
> Just guessing though.

With this and the info on the page Tony mentioned, I settled for:

:0
* ^Subject:.*foo.*test
{
        :0fhw
        | /usr/bin/perl -pe '!/^(Subject:.*)\[Foo\]/s && 
s/^(Subject:\s*)(.*)$/${1}[Foo] $2/s;'
        | $DELIVERMAIL -e -a $CYUSER -m $MAIN
}

Seems to work, although there's probably a more lightweight way of doing the 
mangle than Perl. NB: This method only pre-pends [Foo] if there's not already 
a [Foo] in the subject line...

-- 
. Trevor Phillips             -           http://jurai.murdoch.edu.au/ . 
: Web Technical Administrator     -          T.Phillips at murdoch.edu.au : 
| IT Services                        -              Murdoch University | 
 >--------------------------------------------------------------------<
| On nights such as this, evil deeds are done. And good deeds, of     /
| course. But mostly evil, on the whole.                             /
 \      -- (Terry Pratchett, Wyrd Sisters)                          /



More information about the plug mailing list