procmail
[Top] [All Lists]

Re: Spammish?

2003-02-16 17:28:33
fleet(_at_)teachout(_dot_)org wrote:

I suspect I could construct a recipe that counted the Received: 
lines based on the examples Don supplied this
morning; but do you have on that does that?

  * $  1^1  ^Received:
  { RCVD_COUNT = $= }

would work fine.


In my own rc, I save the value of the bottommost on and
the one just-up from the bottom, for later spaminess checks.
I combine the overall count with the saving of the bottom one.
I only concern myself with those Received: lines that start
with "from" thereafter, because others are not formed for
SMTP transport but are often internal, e.g., between a
host and that system's mail server.  The qmail Received:
headers in quotation marks are examples that I ignore.


 ## Things to do with Received:

 :0  # 030114 () find bottommost "standard" Received:, and header-count
  * $  1^1  ^Received:[$WS]*\/from\>.+
  { BTM_RCVD = $MATCH   RCVD_COUNT = $= }


Then, to find the next one up, I utilize the trick with supremum that
I thought up last month:

     :0  #030211 () find next-to-bottom Received: (using the "infinity
shuffle")
      * $  -$RCVD_COUNT^0  ! RCVD_COUNT  ?? ^^1^^
      * $     $SUPREMUM^0
      *               1^0
      * $             1^1    ^Received:[$WS]*\/from\>.+
      { BOTTOMSUP = $MATCH }



Silly probably, but actually considered producing a binary score by
concatenating 1's in a variable - 1 = 1 11=3 111=5, etc. :) 
Or obtain the score by checking the length of the variable. Not sure 
how to do that from within procmail, though.

The length?  Bart Schaefer stated one way last month, and I saved it
because I thought it was pretty cool.

Maybe this has always been obvious to SRB and Philip G., but:

:0
* 1^1 STRING ?? > 1
{
 LOG="The length of $STRING is $=
"
}

However, you can also anchor the variable on both sides, as I did
above with RCVD_COUNT in the first condition line of the second
recipe, as a way to test its length.

You asked elsewhere how to tell what's in the $SPAMISH variable
later in the recipe.  Maybe that's clear to you meanwhile, I am
not sure.  But here's how I do it.  $TRUE is just a dot, btw,
and you could also just use a literal dot:

 :0  # 030105 () if any VIR/UBE recipe succeeded, dispatch message
  * $  RX  ??  $TRUE
  { SWITCHRC = $RX_DELIVER }


HTH,
Dallman


-- 
"If you find a path with no obstacles, it probably does not lead to
anywhere."
        Thoughts of Rev. Sunnan Kubose, from _Zen in the Markets_  


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

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