Amavisd-new has a feature that you can enable viz:

        if SPAM then transform [EMAIL PROTECTED] -> [EMAIL PROTECTED]

Then your delivery agent can refile it on the fly.

Alternatively, you can do this yourself by either hacking the
maildeliver or placing a script in the pipeline (or by writing
your own delivery agent, which is what I do) to make the same
transform as amavisd-new.

If I hadn't already written a new delivery agent, I would have
been eager to use the amavisd-new wrapper.  I think I still will,
but the pressure is not so high.

Unfortunately for all of us, spamc doesn't fully implement the
spamassassin command line.  Plain spamassassin is too slow to 
start for more than a few hundreds of emails per day, so spamc
is necessary.  However, spamc doesn't have the 'exit-code' option
which makes it trivial to script up the re-write.

I had the following coded up in the ksh (Lots of error-checking
and mua feature support hacks removed):

        domain=$3               #From command line
        recip=$4                #From command line

        DOMAIN=$( match_domain $domain )
        RECIP=$( match_recip $recip )


        # drop message on stdin into temp file
        
        if spamassassin -e > $tmpfile
        then
                RECIP=$( fixup_recip "+spam" $RECIP )
        fi

        RecipDir=${POPSTOREPATH}/$DOMAIN/$RECIP
        deliver $RecipDir < $tmpfile

To do that with spamc:

        # drop message on stdin into temp file
        
        spamc -e > $tmpfile

        if egrep -s 'X-spam-flag: YES' $tmpfile
        then
                RECIP=$( fixup_recip "+spam" $RECIP )
        fi

For us, it's a stylistic matter at present.  spamc+egrep -s is still
between 10 and 100 times faster than plain spamassassin.

Note that I don't re-write the recip addr in the message, I just refile it.
I'm certain that with nawk or a judicious use of egrep and sed that one
could rewrite the recipient in the message on the fly, and then deliver
normally, viz:

        | /usr/bin/spamassassin -P | fixup_to_if_spam | /usr/bin/maildir 


Cheers!
-sam


-------------------------------------------------------
This sf.net email is sponsored by:ThinkGeek
Welcome to geek heaven.
http://thinkgeek.com/sf
_______________________________________________
Spamassassin-talk mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/spamassassin-talk

Reply via email to