procmail
[Top] [All Lists]

Re: help needed to filter class mailing list....

1998-02-07 05:25:24
At 10:32 PM 2/6/98 -0500, Amith Varghese wrote:
I'm a student at the University of Virginia and I'm taking a
software development course.  The instructors and TAs in this
class have decided that every e-mail going to the course
account should be forwarded along with the reply to everyone
in the class so no repetitive questions are asked.  Of course
this means that I get 10 messages a day that i have little
concern with.  What I want to do is to store all messages
coming from the TAs, while letting the
professor's e-mails go through.  This is the .procmailrc file
that I wrote

PATH=/bin:/usr/bin:/usr/local/bin:/uva/bin/procmail
MAILDIR=/home/$LOGNAME/Mail
DEFAULT=/var/spool/mail/$LOGNAME
LOGFILE=$HOME/cs340logs/log.`date +%y-%m-%d`
SHELL=/bin/sh

:0:
* ^From.*Mike Esler|.*Mark M. Morgan|.*Vibha Sazawal
* 
^(To:|cc:|Cc:|bcc:|Bcc:)(_dot_)*cs340-students(_at_)cs(_dot_)virginia(_dot_)edu
cs340

I think you want that first line to be:
  * ^From(.*Mike Esler|.*Mark M\. Morgan|.*Vibha Sazawal)
because without the parentheses it will match ANY header
containing either Mark's or Vibha's name.  [It's probably
better to use their email address rather than their name
as well, though this may do for your current needs.]  More
than likely, you want just the From: header, thus:
  * ^From:.*(Mike Esler|Mark M\. Morgan|Vibha Sazawal)

However, I am having a problem.  First, when i run

cat /var/spool/mail/akv6p | procmail .procmailrc

it successfully takes the message and stores it in
/home/akv6p/Mail/cs340, but the problem is it doesn't delete
the message from /var/spool/mail/akv6p.  Why won't it remove
the message from the system box once it has stored it?

Procmail never removes messages; what it will do is not
deliver them to the system box in the first place.  Your
experiment might even loop "forever" if you had lots of mail
in your mailbox that didn't match your recipe.  You should
have your test input in a file that won't be modified during
the experiment.

The other problem is how can I automate this so that every time
a new piece of mail arrives, procmail is automatically run on
it to filter the messages and store them in a separate place?
I have no root access because it is a school machine.

See the man pages about setting up a .forward file.

Hope that helps,
Stan

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