procmail
[Top] [All Lists]

Beginner needs help

1996-11-25 13:23:36
Just started to play with procmail...

What I want to do..

A 'pseudo' login gets mail.  It feeds it through a script which exits 
0 if all is OK - otherwise not a zero.  If the script gave zero, no 
need to do anything else.  If there was a non-zero exit, forward the 
mail to my own account and tell the sender that something went wrong.  
There is no need to then keep the original mail.  Ideally, the mail I 
forward to myself (mje) would have an extra header - so I could see 
that the mail has been through this process.  
I'm also toying with the idea of storing the bad applications in
a seperate directory (sequentially numbered) so I can process them
later... one by one.

My OS... Linux - Slackware 3.1

What I have...

SHELL=/bin/sh
PATH=/bin:/usr/bin:/usr/bin:/usr/local/bin
MAILDIR=$HOME/mail-log
DEFAULT=/dev/null
LOGFILE=$MAILDIR/from


:0 Whfbc: auto-script.lock
* !^X-Loop: automatic(_at_)my(_dot_)machine(_dot_)com    # Been here before?
| auto-script >> Logfile

    :0 ec         # if there was an error code
    {
    :0 c
    ! mje         # Send errors to me (be nice to know it has been here though!)

    :0 hc         # Tell sender about the problem
    | (formail -rA"Precedence: junk" \
         -A"X-Loop: automatic(_at_)my(_dot_)machine(_dot_)com" ; \
       echo "You hit the Automatic administrator - but there was a problem"; \
       echo "You will either have to wait - or fix the problem yourself"; \
       echo "and resubmit. Diagnostics will follow in a seperate mail."; \
       echo "-- "; cat $HOME/.signature \
      ) | $SENDMAIL -oi -t
    }


Suggestions to improve this code?  I've read the MAN pages and the
'best-of' FAQ..  but don't understand all this yet, ie - why I have to
specify /dev/null as I do, otherwise I get duplicate messages in the
default mail-box.

-- 
  .  .     ___. .__      Olivetti Systems & Networks, Unix Support - Sth Africa
 /| /|       / /__       mje(_at_)posix(_dot_)co(_dot_)za  -  Mark J Elkins, 
SCO ACE, Cisco CCIE
/ |/ |ARK \_/ /__ LKINS  Tel: +27 11 456 3125  Cell: +27 82 601 0496

<Prev in Thread] Current Thread [Next in Thread>
  • Beginner needs help, Mark J Elkins <=