procmail
[Top] [All Lists]

Re: Reject recipe

1999-08-16 02:55:28
On Sat, 14 Aug 1999 16:59:20 -0300,
Hermann Wecke <hermann(_at_)rodeios(_dot_)com> wrote:
The modified SpamDunk recipe is available at
http://www.rodeios.com/nospam/procmailtest.txt

Ahem, this is +huge+ and +complicated+, it would perhaps be better to
include only the part you changed, or at least describe what your
changes are.

I assume the two recipes at the end are yours:

#
# If an X-reject: header is found in the message after consulting
# the lists, reject the email to the sender.
#
:0
*1^1 ^X-Reject:
{
:0fhwr # duplicate the head
| sed -e H -e '$ G'

:0bfw # strip second head down to specific needed fields
| formail -bk-X-X-Reject: -XFrom: -XTo: -XDate: -XSubject:

:0fbw
| ( echo "--++" ; echo "end" ; echo "" ; \
echo (multiple lines in two languages explaining that the message was rejected)
echo "" ; echo "" ; echo ; sed 's/^/> /' ) \

:0
* ^Subject:[         ]*\/[^  ].*
| formail -rtkb -I"Subject: Message rejected (was: $MATCH)" -I"From: 
Postmaster WECKE <nobody(_at_)wecke(_dot_)com>" -I"Reply-To: 
nobody(_at_)wecke(_dot_)com" -I"Precedence: junk" \
| $SENDMAIL $SENDMAILFLAGS -t
}

Some general comments:

  * No need to use scoring, the 1^1 is completely superfluous. Scoring
    is helpful when the +number+ of matches is somehow relevant, but
    here, you only care whether there is one or more matches. This is
    inefficient because the scoring forces Procmail to scan the entire
    headers to find out how many matches there are, whereas without
    the scoring, it will know to stop when it has found a match. (On a
    cosmic scale, scanning a few more lines of headers is not often a
    big deal, of course, and if somebody sends you a message with
    multi-megabyte headers, you're perhaps going to end up in trouble
    anyway. But it's useful to know what you're doing and leave out
    the parts which aren't necessary.)

  * The first invocation of formail contains a couple of syntax errors
    but other than that, the idea is sound. formail -k -XX-Reject: -X... 
    should do what you want.

  * The multiple filtering passes seem a bit complicated, perhaps it
    would be easier to create a single script which does all the reply
    processing.

  * Technically, formail -rt will only need a few choice headers, so
    you could perhaps get away with passing it stripped-down headers.
    (Never mind, this isn't really important or constructive, I'm
    just thinking aloud here.)

  * formail can quote the message it replies to, try the -p option

Other than that, I'll agree with Walter that bouncing unwanted
messages after your MTA has accepted them is probabably not very
constructive. If you have control over your MTA or can get your
upstream to reject connections from the domains you have trouble with,
that's definitely a better idea.

Hope this helps,

/* era */

-- 
 Too much to say to fit into this .signature anyway: <http://www.iki.fi/era/>
  Fight spam in Europe: <http://www.euro.cauce.org/> * Sign the EU petition

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