procmail
[Top] [All Lists]

Re: filter number(_at_)foobar(_dot_)com

1999-08-08 07:50:24
On Sat, 7 Aug 1999 23:36:48 -0400, Scott Fabbri <smf(_at_)pobox(_dot_)com> 
wrote:
At 01:42 +0200 8/8/99, Christophe Zwecker wrote:
era eriksson <era(_at_)iki(_dot_)fi> wrote:
instance) although I haven't experimented. (Hint: Match each body
part with an unrecognized type, and pass that in as JA_MIME_TYPE;
repeat as necessary.)
I played with that, but there can always an new unknown type, I
was looking for something that works all the time, IF there is
such a thing.
Why not just dump any parts that aren't text/* (or text/plain, if
you want to be more restrictive, though you might lose messages
from mailers that use text/enriched, like exmh or Eudora).

Yeah, that's what I was getting at. You need to do it recursively,
something like

INCLUDERC=kill-non-text.rc

kill-non-text.rc:

:0  # this is pretty ugly, but the best I could come up with quickly
* ^Content-Type:[       ]*\/\
        ([^t][a-z/]+|t\
        ([^e][a-z/]+|e\
        ([^x][a-z/]+|x\
        ([^t][a-z/]+|t\
        ([^/][a-z]+|/\
        ([^p][a-z]+|p\
        ([^l][a-z]*|l\
        ([^a][a-z]*|a\
        ([^i][a-z]*|i\
        ([^n][a-z]*))))))))))
{
        # Set up JA_MIME_TYPE to kill all attachments of the captured type
        JA_MIME_TYPE=$MATCH
        # Run kill thingy
        INCLUDERC=ja_kill_mime.rc
        # Now recurse to see if there are more types left
        INCLUDERC=kill-non-text.rc
}

# Falls thru to here when there are only text/plain attachments left


This seems to cry out for a Perl script of some type.

That is probably simpler and more robust, yes.

/* era */

-- 
 Too much to say to fit into this .signature anyway: <http://www.iki.fi/era/>
  Fight spam in Europe: <http://www.euro.cauce.org/> * Sign the EU petition