procmail
[Top] [All Lists]

Re: Match if "no other but base64 encoding"

2006-12-21 14:49:58
On 12/21/06, Rado S <rado(_at_)math(_dot_)uni-hamburg(_dot_)de> wrote:
a) single part, top-lvl check for base64 == true -> spam.

That would be the first of the two recipes I posted previously.

b) multipart, 1 text/plain exists (among possibly others, but even
if alone), yet each of the existing parts has only base64.
        => spam!

If what you want is "there is a text/plain part AND every body part is
base64" then the best way is to use scoring.  I'm not sure why you
care that there is a text/plain part, but ...

:0B
* H ?? ^Content-Type: *multipart
* ^Content-Type: *text */ *plain
* 1^1 ^Content-Transfer-Encoding: *base64
* -1^1 ^Content-Type:
{}
:0E:
$BASE64

This says to add one to the score for every base64 c-t-e, then
subtract one for every content-type.  If the resulting score is
positive, then at least one part did NOT have base64 encoding, so do
nothing (the empty braces).  Else, deliver to $BASE64.

There are still some border cases this might not catch.  For example,
the Content-Type bodypart header can be omitted for text/plain, so a
valid MIME message might have a text/plain part that has ONLY a c-t-e
base64 header, in which case the whole message would be flagged as
base64 even if there was some other part that was NOT base64 encoded.
I'd expect that to be vanishingly rare, though.

____________________________________________________________
procmail mailing list   Procmail homepage: http://www.procmail.org/
procmail(_at_)lists(_dot_)RWTH-Aachen(_dot_)DE
http://MailMan.RWTH-Aachen.DE/mailman/listinfo/procmail