procmail
[Top] [All Lists]

Re: Bouncing/refusing mail with EXITCODE

1997-04-14 02:01:00
On Sun, 13 Apr 1997 19:15:13 -0700 (PDT),
James Vahn <jvahn(_at_)short(_dot_)circuit(_dot_)com> wrote:
Does anyone on this list successfully use the EXITCODE approach to
basically pretend that the mail is undeliverable?
:0
* ^(From|Message-id|Received):(.*andernet.org|.*earthlink\
|.*dm1.com|.*quant|.*telysis|.*sprynet|.*bellsouth|.*rosey\
|.*worldnet|.*bell|.*getnet|.*grafix|.*voyager|.*aol.com\
|.*origin suppressed|.*kiminc|.*cyber|.*america|.*redrove\
|.*concentric|.*cris.com|.*indiana)
{
        EXITCODE=67
        :0
        TRASHCAN
}

This has the same regular expression problem Eli pointed out with the
other recipe, and also a whole lot of redundant .* wildcards. I don't
think it will affect performance very much either way, but at least
for readability, I'd use only one .* and put it outside the parens. 

Also, you might want to undefine HOST in order to terminate processing
immediately. 

TRASHCAN looks like it's a synonym of /dev/null (since you're not
locking it); merely setting EXITCODE and unsetting HOST will lose the
message for you automatically; you don't have to save it anywhere
then. 

So we might end up with:

:0
* ^(From|Message-Id|Received):.*\<(andernet\.org|earthlink\
|dm1\.com|telysis|sprynet|bellsouth|rosey|worldnet|bell|getnet\
|grafix|voyager|aol\.com|origin suppressed|kiminc|america|redrove\
|concentric|cris\.com|indiana\
(# match end of word or end of line: |\>|$))\
|(# the rilly rilly bad ones: |quant|cyber)
{
    EXITCODE=67 HOST
}

The comments in the regular expression should hopefully not be harmful
-- this is untested, though. I'm assuming that "cyber" and "quant" are
phrases you want to ditch immediately (including cybernothing,
quantum, and a number of other very non-spam domains); the others have
to be anchored at the end in order to match. All of these phrases are
anchored to a non-word character at the beginning. 

If the list grows much, you will end up exceeding LINEBUF which might
need upward adjustment -- or just put this in an external file and use
grep or something. (Perl would be my choice if I ended up running an
external program for anything like this. You can get good Perl
antispam snippets from some sites like Rahul.net which you might
include.)

/* era */

Do you receive any mail whatsoever? ;^)

-- 
Defin-i-t-e-ly. Sep-a-r-a-te. Gram-m-a-r.  <http://www.iki.fi/~era/>
 * Enjoy receiving spam? Register at <http://www.iki.fi/~era/spam.html>

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