procmail
[Top] [All Lists]

Procmail questions

1997-04-16 05:53:00

Hello,

I have some probably basic questions about the use of procmail.
I would appreciate it if you can help me.

Here is what I am trying to do.  I would like to set up a filter
to select mail I receive from a select few people and forward them
to a different machine.  I understand the .procmailrc recipes part.
My problem seems to be with automating the forwarding.

I can not set up procmail as the mail delivery agent since I
don't have control over that.  So I decided to write a shell
script invoked by cron evry so often to do the processing.
Here are the scripts I wrote - they are based on your examples
and are very simple.  I did not think locking of the mail files
is an issue for me.  My plan is to copy the file to /tmp and
delete it after processing.  As you can tell, I am not after
efficiency or complete foolproofness.  I just want to start simple
and build up.

The problem I am having are:

The script starts procmail, but procmail never completes execution.
The mail gets forwarded however.

The contents of my mail file are getting duplicated everytime I
run the script.  I suspect this is because procmail is writing output 
back to the system mailfile.  But I don't know how to control where
procmail writes to.

Please look at the attached script and .procmailrc and let me know
of the corrections I should make.

Thank you very much.

Sincerely,
Raghu Yadavalli
========= pmail script invoked from cron 

#!/bin/sh
#
MAILFILE=/usr/spool/mail/$LOGNAME
TEMPFILE=/tmp/xxpmail
LOCALBIN=/usr/local/bin

cp -p $MAILFILE $TEMPFILE &&
chmod go+rw $TEMPFILE
$LOCALBIN/formail -s $LOCALBIN/procmail <$TEMPFILE
rm -f $TEMPFILE

======== .procmailrc

#
#
PATH=/bin:/usr/bin:/tmp/bin:/usr/local/bin
#MAILDIR=/usr/spool/mail
MAILDIR=/tmp
#DEFAULT=$MAILDIR/$LOGNAME
#
:0 Hc
* ^From.*deven
! raghuy(_at_)baynetworks(_dot_)com

:0 HBc
* southam
! cry(_at_)netcom(_dot_)com

========== End ========

<Prev in Thread] Current Thread [Next in Thread>
  • Procmail questions, Raghu Yadavalli <=