#!/bin/sh # XMSpamPost: XMail filter (post-data) # which checks if an e-mail is spam or not, using Spamassassin. # Copyright (C) 2006 Jean-Francois Hovinne - http://www.hovinne.com/dev/xmspam/ # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 2 of the License, or # (at your option) any later version. # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details: http://www.gnu.org/licenses/gpl.txt. # USAGE: edit filters.post-data.tab: # "/usr/sbin/XMSpamPost" "@@FILE" "@@REMOTEADDR" BASEDIR="/var/lib/spamassassin" DATE=`date +%Y%m%d` HAMFILE="$BASEDIR/white/ham-$DATE" SPAMFILE="$BASEDIR/black/spam-$DATE" /usr/bin/tail -n+7 $1 | /usr/bin/spamc -c -u spamassassin > /dev/null if [ "$?" -eq "1" ]; then echo $2 >> $SPAMFILE exit 3 else echo $2 >> $HAMFILE exit 0 fi