Sorry. I should have been a little more elaborate.

The message you posted yesterday had two responses. Both pretty much were in agreement the .qmail file handles messages after the SMTP session.

One of the responses mentioned using qmail-scanner.

On Wed, 13 Jun 2007, Hendrik Helmvoigt wrote:

Hi,

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.

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

If you want to test the setup, you can send a mail with for example GTUBE to [EMAIL PROTECTED]

Your advice will be welcome,
arni

Reply via email to