procmail
[Top] [All Lists]

Re: Conflict between c flag and filter

2002-08-27 07:58:15
On 27 Aug, Udi Mottelo wrote:
| 
|       I try to save all the messages in one folder, but, if the message
|       is infected by virus, I want to save its header in other file.
|       It is not problem to get the header:
| 
| :0 fhw
||cat > filename
| 
|       The problem start by adding the "c" flag - of course, procmail
|       Continue with the body only!   In the following is my recipe
|       and again I do not like the solution because I have a feeling
|       that I missed something and procmail can do it by setting the
|       right flags.
| 
| :0 H
| * with ESMTP id \/[^    ]+
| {
| FILE=/var/tmp/Udi/Vdir/$MATCH
| HEADER=/var/tmp/Udi/Vdir/$LOGNAME.$MATCH
| ANTIVIRUS="/usr/local/sbin/f-prot -dumb -archive -silent"
| NOTHING=
| 
|       :0 c
|       $FILE
| 
|       :0 Bw
|       * 1^0 $ ! ? $ANTIVIRUS $FILE
|       * 0^0 $ NOTHING ?? ? /bin/rm $FILE
|       {
|               :0 fhwc
|               |cat | tee $HEADER
|       }
| }
| 
| :0
| /var/tmp/Udi/bigfolder
| 
| 
|       Any ideas?
| 

I don't understand what you mean by procmail continuing "with the body
only".  I'm also not sure what is/isn't happening that you do/don't
want or expect. But I'm sure as can be (famous last words) that you
don't want the "f" filter flag on either of the two examples you give
above. The "f" flag renders them non-delivering, and procmail  continues
to process the message (2 of them with the "c" flag). You also don't
need the cat (UUOC), and I have no clue what you're trying to do with
tee.

If you're just trying to save headers, may I suggest:

:0 hw:
headers

or maybe better:

:0 hw:
| gzip -c >>headers.gz

or if you want to save a copy of the headers, but otherwise continue
processing the message:

:0 hwc:
headers

or

:0 hwc:
| gzip -c >>headers.gz


-- 
Reply to list please, or append "8" to "procmail" in address if you must.
Spammers' unrelenting address harvesting forces me to this...reluctantly.


_______________________________________________
procmail mailing list
procmail(_at_)lists(_dot_)RWTH-Aachen(_dot_)DE
http://MailMan.RWTH-Aachen.DE/mailman/listinfo/procmail