#!/bin/sh PATH=$HOME/bin:/usr/local/bin:/usr/bin:/bin TMP=/tmp/spamcheck.$$ trap 'rm -rf $TMP; exit 111' 1 2 3 15 spamc >$TMP if grep -q '^X-Spam-Flag: YES$' $TMP; then maildir Spamdir <$TMP; rc=$? rm -f $TMP [ $rc -eq 0 ] && exit 99 || exit 111 else if [ -z "$SENDER" ]; then maildir Spamdir <$TMP; rc=$? rm -f $TMP [ $rc -eq 0 ] && exit 99 || exit 111 else maildir Maildir <$TMP; rc=$? rm -f $TMP [ $rc -eq 0 ] && exit 0 || exit 111 fi fi