procmail
[Top] [All Lists]

Re: basic filtering problem

1996-04-30 11:41:57
Josh Kramer <kramer(_at_)gfs(_dot_)pvt(_dot_)k12(_dot_)pa(_dot_)us> writes:

In my .procmailrc file, I have a few recipes to redirect annoying threads 
to spool files in my mail directory, and also to drop the procmail list into 
its own file. These don't appear to do anything; the files remain empty, and 
all mail goes to 'inbox.'

Any suggestions?

Excerpt from .procmailrc follows:

PATH=:/usr/bin:/bin:/usr/local/bin:.
MAILDIR=~kramer/mail

Procmail doesn't do '~' expansion.  (The procmailrc(5) manpage actually
mentions this in thig BUGS sections.)  Since MAILDIR starts out as
$HOME (which is what '~' normally expands to) the above should be
written as:

        MAILDIR = mail
or
        MAILDIR = $HOME/mail

Note that with your original version, procmail tried to change
directories into the directory "$HOME/~kramer/mail", where that '~' is
a literal tilda.



:0:.lockfile0                          # Anything from people at Informatik
* ^From(_dot_)*(_at_)Informatik(_dot_)RWTH-Aachen(_dot_)DE
~kramer/mail/procmail_list             # will go to spool file

These should all be written as relative files.  Otherwise, why bother
with the setting of MAILDIR?  I'd suggest letting procmail choose the
lockfile by just using a colon, as in:

:0:
* ^From(_dot_)*(_at_)Informatik(_dot_)RWTH-Aachen(_dot_)DE
procmail_list



:0:.lockfile1                  # All 'taking action' will go to
* ^Subject:.*Taking action*
~kramer/mail/threads                           # spool file

:0:.lockfile2                  # All 'read this or die' will go to
* ^Subject:.*READ THIS OR DIE*
~kramer/mail/threads                   # spool file

:0:.lockfile3                  # All 'More Limericks' will go to
* ^Subject:.*More Limericks*
~kramer/mail/threads                   # spool file


DANGER DANGER DANGER DANGER DANGER DANGER DANGER DANGER DANGER DANGER 

You have three recipes, all trying to write to the same file, WITH
DIFFERENT LOCKFILES.  This is, shall we say, "very bad".  This is
why you let procmail decide the lockfile for you: it would use the
same lockfile given the same folder.

Also, the trailing '*' on the conditions does not do what you think it
does.  Leave it off.  (These are regular expressions, not file
expansion expressions.  Re-read the procmailrc(5) manpage's section on
"Extended regular expressions".)

:0:
* ^Subject:.*Taking action
threads

:0:
* ^Subject:.*READ THIS OR DIE
threads

:0:
* ^Subject:.*More Limericks
threads


Finally, if you just want to 'or' the conditions, you can always use
one big regexp:

:0:
* ^Subject:.*(Taking action|READ THIS OR DIE|More Limericks)
threads


But if you're adding and removing this fairly often, then the former
setup with separate recipes may be more conveniant.

Philip Guenther

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