procmail
[Top] [All Lists]

Newbie Problem with Nesting Actions

2002-12-17 07:21:23
Hello,

I'm trying to write a procmail recipe that will allow users to send a
message to themselves to either enable or disable mail forwarding.

My conditions work ok, but it skips my actions. I've added comments for
this post.   

Thank you.  -Jeff Borders  jeff(_at_)jeffborders(_dot_)com

SHELL = /bin/sh
MAILDIR = $HOME/Mail
LOGFILE = $HOME/procmail.log
VERBOSE = yes
LOGABSTRACT = no
PATH = /bin:/usr/bin:/usr/local/bin

### User's non-forwarded address ###
MUSERADDR="user(_at_)work(_dot_)com"  

### Check for Loops ###
:0
* ! ^X-Loop: $MUSERADDR
{
:0cwHB
### Check for secret phrase ###
* ^subject: *some_secret_phrase
        {
        ### Check the body of message for new forwarding address ###
        NEWADDR=`formail -I ""`  
        :0w
        ### Check value.  Either has new address or is blank ###
        ### If it's not empty, forward ###
        * ! NEWADDR ?? ^^^^  
                { 
                MESSAGE="Your mail is now being forwarded to your $NEWADDR 
account."  ;\
                | echo $NEWADDR > ~/.forward ;\
                | mailto -s "Mail Forwarding Request" $MUSERADDR < $MESSAGE
                }
        :0E
                {
                MESSAGE="Your mail is no longer being forwarded." ;\
                | rm -f ~/.forward ;\
                | mailto -s "Mail Forwarding Turned Off ..." $MUSERADDR < 
$MESSAGE
                }
        }
}
# Discard Mail Loops
:0
* ^X-Loop: $MUSERADDR
/dev/null

:0
${DEFAULT}



_______________________________________________
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>