procmail
[Top] [All Lists]

Re: spawning an external app

2001-02-17 21:29:43
Justin Shore <listuser(_at_)vinnie(_dot_)ksu(_dot_)ksu(_dot_)edu> writes:
...
VIRUSADDR=virus-alert(_at_)sktc(_dot_)net
:0 h c
* !^FROM_DAEMON
* !^X-Loop: $VIRUSADDR
* ^Subject: Test bounce message
| (formail -r \
-I"From: SKTC Virus Alert Daemon <$VIRUSADDR>" \
-I"Subject: [Virus Alert]  You've been infected" \
-A"X-Loop: $VIRUSADDR" ; \
/bin/cat "/etc/mail/vbs.ss-txt") | $SENDMAIL -t

If you'd like to test it, send a message to 
shorej(_at_)maple(_dot_)sktc(_dot_)net, 
subject: "Test bounce message".  Are there any better ways of doing 
this?  Can anyone think of any downsides to doing this?  I think this 
is more helpful to virus ridden users than a 553.  Thanks for your 
help, Philip!  It's much appreciated

Whoops, I missed one other thing: by default, variables are not expanded
on condition lines.  So that second condition won't work because the
$VIRUSADDR won't be expanded.  To solve that, put a '$' before the
regexp itself.  I also like indenting things to show their structure
and/or similarity, so:

        VIRUSADDR=virus-alert(_at_)sktc(_dot_)net
        :0 h c
        * !   ^FROM_DAEMON
        * ! $ ^X-Loop: $\VIRUSADDR
        *     ^Subject: Test bounce message
        | (formail -r \
                -I"From: SKTC Virus Alert Daemon <$VIRUSADDR>" \
                -I"Subject: [Virus Alert]  You've been infected" \
                -A"X-Loop: $VIRUSADDR" ; \
           cat /etc/mail/vbs.ss-txt ) | $SENDMAIL $SENDMAILFLAGS -t

(The backslash in $\VIRUSADDR makes procmail escape all the special
regexp characters in the expanded value, such that it'll match just the
literal text.  In this case, it'll make the '.' in "sktc.net" match just
a period, and not any character like it normally does in a regexp.)


Philip Guenther
_______________________________________________
procmail mailing list
procmail(_at_)lists(_dot_)RWTH-Aachen(_dot_)DE
http://MailMan.RWTH-Aachen.DE/mailman/listinfo/procmail