Subject: more on procmail

From: Rick Macdonald <[email-masked]>
Date: Mon, 26 Aug 1996 14:04:26 -0600

There have been a lot of posts about procmail, so I thought I'd jump in
with a question too.

I've installed procmail, but haven't done anything with it yet.

I use Netscape for a mail reader at home and office. It only uses file
locking on the system mail spool (the Inbox), not any of the folders
that it uses and maintains.

I figure (and Netscape sortof warns) that using a mail filter like
procmail or mailagent that intercepts mail and writes it to Netscape's
folders would be asking for trouble.

So, I figure I need a program to use as an external movemail program for
Netscape (I've been using its internal one) that has the smarts of a
mail filter.

Can procmail or mailagent be used as a batch "movemail" program like
this?
I figure that it would be safe, since it would only be executed by
Netscape when I click the GetMail button. It's not hard to remember not
to do anything else within the Netscape mail reader while it's
processing the button that I just clicked to get new mail.

Whether or not the above is possible, is there some other way to safely
combine a mail filter program and a mail reader that doesn't use locks
on it's mail folders?

-- 
...RickM...

---

From: Anthony Martin <[email-masked]>
Date: Mon, 26 Aug 1996 17:26:34 -0700 (PDT)

> Can procmail or mailagent be used as a batch "movemail" program like

Yes, procmail comes with a sample script for doing this with procmail.
Since my system doesn't allow forwarding to a program (grrrrr), I just run
this script that I call 'getmail' from my login shell.  I suppose it would
work as you want with netscape, but I can't guarantee anything.  Procmail
can use local locks on the folders which I assume that netscape would
honor, but I haven't tried it.  Appended is the 'getmail' script.

Tony.

#!/bin/sh
ORGMAIL=/var/spool/mail/$LOGNAME
if cd $HOME &&
test -s $ORGMAIL &&
lockfile -r0 -l1024 .newmail.lock 2>/dev/null
then
trap "rm -f .newmail.lock" 1 2 3 13 15
umask 077
lockfile -l1024 -ml
cat $ORGMAIL >>.newmail &&
cat /dev/null >$ORGMAIL
lockfile -mu
formail -s procmail <.newmail &&
rm -f .newmail
rm -f .newmail.lock
fi
exit 0