procmail
[Top] [All Lists]

worth it to convert shell script into procmailrc?

2003-06-30 17:16:55
[I found out if I'm not a subscriber, my posts go to /dev/null,
not to say they don't belong there anyway.]

Should I convert my silly little
http://jidanni.org/comp/spam/spamdealer.html project from a shell
script that calls procmail into a pure procmail program?

I was told to use the maildropfilter method but I feel that that
doesn't seem as well polished a program as procmail must be.

OK in particular, how in procmail can I,


    max=200000 s=$HOME/spamdealer; err=$s/errors PATH=$HOME/bin:$PATH
    exec 2>> $err

I want to set the PATH so I can pick up any local spamassassin
http://pm-doc.sourceforge.net/pm-tips.html doesn't seem to say if one
can influence the environment.
I also want to take all the standard error and put it into a file.

    if test $1 -gt $max

OK, that's easy, I just use the ">" operator


    then
        f=$s/big-message; test -r $f && cat $f|| #0 sized $f will turn off the 
bounce


I am outputting to stdout, as I want exim to send my output to whoever
sent the message to me, hope I can output to stdout in procmail too

            echo Beyond $max bytes is too big for my modem. I might not see 
your message soon.
        { echo "X-Spamdealer-Status: Big **** SIZE=$1 ****"; cat;}|procmail

OK, procmail can test " > 200000", but how can I refer to the message
size, must I spawn a "wc"?

    else
        umask 077; tmp=/tmp/spamdealer$$
        LC_ALL=C spamassassin -e > $tmp||{
            f=$s/spam-message
            test -r $f && cat $f|| #custom message
               echo Oops! SpamAssassin said it looked like spam. I might not 
see it soon.
            awk 'p&&!/points/{exit};/Content analysis details:/{p=1};p'


Another problem is I should make this MTA independent by using formail
instead of relying on exim to send stdout back to the envelope
sender.  But these all could be spoofed into sending to innocents. 
    }
        procmail<$tmp && rm $tmp
    fi
    # when does procmail return non-zero? Its man page doesn't say.

All the .procmailrc did was
:0:
* ^X-Spamdealer-Status: Big
Mail/big-possible-spam/

:0:
* ^X-Spam-Level: \*\*\*\*\*\*\*\*\*\*\*\*\*\*\*
Mail/almost-certainly-spam/

:0:
* ^X-Spam-Status: Yes
Mail/probably-spam/

So I thought I would merge the shell script into the .procmailrc.  Am
I giving up functionality and flexibility of my familiar shell script
for the more efficient but less flexible and intuitive single procmail
script?  Shall I forget it?

_______________________________________________
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>
  • worth it to convert shell script into procmailrc?, Dan Jacobson <=