procmail
[Top] [All Lists]

Action commands

2001-10-20 00:29:20

New to procmail so please excuse any lame questions.

I want to filter my email. If your on my list then deliever the email
to my mailbox, if not sendback the autoreply. This is a variation
of someones password-required receipe.

I'm sure there is already something like this already out there but
I could not locate one.

My problem is this:

  1) Does procmail pay attention to the exit codes on from shell scripts
     executed as an action? If so how?

  2) Should my checkmail script be sending the email to STDOUT?

Thank you for the help.


Here is my receipe:

  FROM=`formail -xFrom:`
  :0w:
  | checkmail "$FROM"



Here is the checkmail script:



   #!/bin/sh
   LOG=/home/dcaprio/checkmail.log
   AUTHFILE=/home/dcaprio/.procmail/authorized_addrs
   REJFILE=/home/dcaprio/.procmail/rejected_addrs
   
   /usr/xpg4/bin/egrep -is "$@" $AUTHFILE
   
   if [ $? -ne 0 ]; then
     echo "$@ is NOT authorized. Rejecting..." >> $LOG
     /usr/xpg4/bin/egrep -is "$@" $REJFILE
     if [ $? -ne 0 ]; then
       echo "$@" >> $REJFILE
     fi
     exit 127
   fi
     
   echo "$@ is authorized. Delivering..." >> $LOG
   cat <<
   exit 0

_______________________________________________
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>
  • Action commands, Don Caprio <=