Z. B. writes:
I am trying to write a Procmail recipe to filter large amounts of
unwanted mail (to /dev/null, of course) and I have a few questions about
what can and cannot go into a recipe. Here's what I have so far:
:3
! ^From +[^ ]*(postmaster|Mailer)
! ^From +[^ ]*(listproc|majordomo|listserv)
! ^To +[^ ]*(several|mailinglists|seperated|like|this)
/dev/null
Someone correct me (gently ;) if I'm wrong about any of these, but it
looks like there are several problems with this recipe. First, the
":3" should be ":0", and second, your regexp's for the headers won't
work. I believe the format for the mail headers is such that the name
is followed by a colon and any optional whitespace, so you need to put
in a colon and change the + to a * since the whitespace is only
optional. Oh, and the conditions all have to start with a * or
procmail will treat them as the action line.
I think what you want is:
:0
* ! ^From:.*(postmaster|Mailer)
* ! ^From:.*(listproc|majordomo|listserv)
* ! ^TO(several|mailinglists|seperated|like|this)
/dev/null
The ^TO macro generally works better than checking the To: header
alone because it will also catch things like Cc:'s. I'm not sure, but
you could probably use the ^FROM_MAILER macro in place of the first
condition as well. If you want to stop email bombs as the subject
suggests you might also add a size comparison line.
--
__ _ ________
| \/ \ /|_ |_/ "There is no god but caffeine, and Java is its Prophet."
|_/\_//_|__| \ "Hey! It compiles! Ship it!"