procmail
[Top] [All Lists]

Re: Limit on recipe condition length?

1996-10-30 23:40:49
On Wed, 30 Oct 1996 10:18:31 -0800 (PST),
ariel(_at_)best(_dot_)com (Catherine Hampton) wrote:
I have been going nuts trying to get the attached recipe to work.
Stuff processed by all recipes before it works fine, as advertised.
But it appears to be treating the list of blocked spam addresses
as a folder to which to send email, according to my log and from
looking at a truly wierd file in my MAIL directory.

You already got some good suggestions, but let me (again ...) add that
you can make this both smaller and more efficient with a few simple
optimizations. 
  Because of the way regular expression parsers work, it is rather
inefficient to say "anything, followed by anything". Additionally, the
more wildcards you use, the more the matcher has to go looking for
possible matches. 

So if you change this:

* ^(From|Reply-To).((_dot_)*(_at_)(_dot_)*1stamend\(_dot_)com|\
        (_dot_)*(_at_)(_dot_)*add-url\(_dot_)com|\
        (_dot_)*(_at_)(_dot_)*admail|\
        (_dot_)*(_at_)(_dot_)*enterprise\(_dot_)america\(_dot_)com|\

... into something like

    * ^(From|Reply-To):(_dot_)*(_at_)[^ ]*(1stamend|add-url|addmail|\
(etc etc \.\.\. :-)\
        )\.(com|net)

... you can make this regular expression nicer -- both for you and for
Procmail. Note that I simply assume that this.com and this.net are
equivalent -- in my own spam filters, I actually put the .com and .net
addresses in their own subexpressions [like ((a|b)\.com|(c|d)\.net)].

The first part after "Reply-To" means anything, followed by an "@",
optionally followed by any number of non-whitespace characters (the
brackets contain a caret, as in "not", and a space and a tab),
followed by the list of domain names. 
  (Your expression would also unnecessarily match something like
"hate(_at_)foo(_dot_)org (cyberpromo.com haters)".)

Hope this helps,

/* era */

Has somebody looked under the hood enough to verify my assertions?
This is the way regular expressions work in general; I understand the
Procmail implementation is different in some respects. Still, I
wouldn't expect it to be able to optimize these things internally.

-- 
See <http://www.ling.helsinki.fi/~reriksso/> for mantra, disclaimer, etc.
* If you enjoy getting spam, I'd appreciate it if you'd register yourself
  at the following URL:  <http://www.ling.helsinki.fi/~reriksso/spam.html>

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