procmail
[Top] [All Lists]

Re: trying to cut down on volume of mail

1997-01-13 01:49:20
On Mon, 13 Jan 1997, jeffrey covey wrote:
nervous about screwing things up.  does anyone see anything wrong in
any of this?  is it doing what the comments clain it's trying to do?
i'm mainly concerned about the (this|that|the other) construct.  am i
GARBAGE=/dev/null

# Kill those annoying things that kill spams
:0 H
* ^Subject: *cmsg cancel.*
$GARBAGE

This is ok. You could also match the the headerfield "Control:"
instead.

# too many people don't keep the subscribe info, then bug the list
# with unsub requests
:0
* ^FROM_DAEMON
* ^Subject: *unsubscribe
$GARBAGE

This seems ok, too.

##cubase list
# i don't use cubase under any of these platforms or with this hardware,
# so i don't need to read about it.
:0
* ^(Cc|To).*cubase-users
* ^Subject.*(mac|atari|falcon|caf|cam|kurzweil|akai|yamaha|korg|roland)
$GARBAGE

This will match _any_ series of letters in the subject containing any
of the above, such as MacDonald, or emacs, or scam, or camembert. The
regular expression may need to be more specific. But the fact that you
first check the To and Cc fields helps. Change (Cc|To) to (Cc:|To:). 
It's more certain to match what you want. 

##pegasus mail list
# don't use it on a lan, so don't need to read about that.
:0
* ^(Cc|To).*PM-WIN
* ^Subject.*(netware|lan|mercury|mhs)
$GARBAGE

Same cautions apply. 'Subject: I'm planning to do this.' will be dead
meat, because it includes 'lan'

## tia list
# i don't use a mac.
:0
* ^(Cc|To).*tia-users
* ^Subject.*mac
$GARBAGE

Same cautions apply. If the letter-series 'mac' appears in the
Subject, then the mail is dead meat.

Instaed of the construct (Cc|To), why not use the special operator
"^TO". It catches all destinations. Use it like this:
                * ^TOsome.destination

I have used it in my recipe for this mailinglist like this:
                * ^TOprocmail

It is a very simple and useful way to match destinations or
recipients.

Your weaknesses in the above script are in the use of 'regular
expressions' used in matching conditions. A good manpage to read is
'grep', keeping in mind that procmail uses 'egrep' rather than 'grep'
or 'fgrep'.

Regular expressions have brought me near to tears, but they are very
powerful and unforgivingly precise. 

David

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