for a while i've been watching my spamassassin perform great on almost
all spam - i've never had any false positives and also a very low count
of false negatives.
So I thought about rejecting sure spam during the SMTP session and came
up with a few bits of shellscript code thats rejecting spam with a score
of 10 and above (I normally mark spam at 5).

But i'm not really sure if i'm doing it correct - it apears to me like
i'm not rejecting mail but i'm bouncing it which is surely not what i want.

Here is my code which is called as a qmail-command in my .qmail file.

message="`/usr/bin/spamassassin 2>/dev/null`"
if [ $? -eq 1 ]; then
# sa returned an error, make sure we dont lose the mail
exit 111
printf "%s\n" "$message" | grep -qs "X-Spam-Level: \*\*\*\*\*\*\*\*\*\*"
if [ $? -eq 0 ]; then
echo "Message was permanently rejected as spam" >&2
exit 100
printf "%s\n" "$message" | maildir ./Maildir/
exit $?

If you want to test the setup, you can send a mail with for example
GTUBE to rejectspam@arni.name

Your advice will be welcome,