procmail
[Top] [All Lists]

Re: Exclude Attachments

1999-05-03 07:44:19
On Sun, 2 May 1999 12:40:01 +0200,
"Markus Wiedemeier" <pingu(_at_)tin(_dot_)it> wrote:
Whats the best way to create an autoforwarding rule, which 
excludes messages with attachments.

Hmmm, tricky. Depends on what exactly you mean by "attachment".
Perhaps you should think more about the properties of the stuff you
want to avoid forwarding, rather than just lump it all under
"attachments". If it's always binary-encoded data, you can filter on
that instead (see below); if it's always Word documents, perhaps
always from a narrow set of Microsoft users, there are probably
patterns in those messages you can rely on, etc.

Random remarks:

  * Attachments often come as MIME multiparts, but there is no simple
    way to determine from the top-level MIME headers whether the
    message will contain an "attached file" or e.g. a HTML-encrypted
    duplicate of the text of the first, text-only part. (Perhaps you
    want to block those as well, come to think of it.)

  * Attachments are often uuencoded or base64-encoded. You could
    exclude anything with, say, four consecutive lines over 50
    characters long consisting of only printing characters. (Finding
    good patterns for catching base64 and uuencode is left as an
    exercise for the reader. If you're lazy, I believe you could find
    some good examples in the archives of this mailing list; see
    <http://www.rosat.mpe-garching.mpg.de/mailing-lists/procmail/>)

  * Possibly your best bet is to simply not forward anything longer than,
    say, 20000 bytes.

In the end, it's probably easy to find a small set of simple criteria
for what you want, but it's somewhat likely that this will not be 100%
the same as (whatever criteria you use to define) "messages with
attachments". MIME is very versatile and can be used for a number of
very different things.

Hope this helps,

/* era */

.obPeeeve: Perhaps you should trim your .signature, and use a proper
.signature separator (that's newline, dash, dash, space, newline).

-- 
.obBotBait: It shouldn't even matter whether     <http://www.iki.fi/era/>
I am a resident of the state of Washington. <http://members.xoom.com/procmail/>
 * Sign the European spam petition! <http://www.politik-digital.de/spam/en/> *

<Prev in Thread] Current Thread [Next in Thread>