procmail
[Top] [All Lists]

Re: Selective Message Storage

2001-05-31 02:08:19
I have a list of people (bad people) in a file: ~/.badpeople
I want to be able to route mail from those people into a folder called
~/Mail/badpeople. This is really similar to a killfile, except that I
want to save their messages to one place. The standard killfile recipe:

:0 W: $HOME/.badpeople.lock
| egrep -i -f $HOME/.badpeople

only serves to lose their mail, not store it somewhere. But the egrep
line here appears to be the starting point. Anyone know how to do this
using a list of email addresses from a file, as above?

You can turn the egrep into a condition like this:

  :0 :
  * ? egrep -i -f $HOME/.badpeople
  badpeoplemail

The '?' on the condition line makes the condition match if the program
exits with a 0 status.  Egrep exits with 0 when it finds matches, so
this does what you want.  Any mail from the bad people goes into the
badpeoplemail mailbox.

It would, of course, be more efficient to keep the list of bad people in
a procmail recipe rather than using egrep to do the regex match.  But
that should do the job.

Hope that's a help,
Martin
-- 
Martin McCarthy                 /</                  PGP key available
    `Procmail Companion'        \>\  http://www.ancient-scotland.co.uk
     Addison Wesley             /</    http://www.ehabitat.demon.co.uk
_______________________________________________
procmail mailing list
procmail(_at_)lists(_dot_)RWTH-Aachen(_dot_)DE
http://MailMan.RWTH-Aachen.DE/mailman/listinfo/procmail

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