summaryrefslogtreecommitdiff
path: root/learn-spam
blob: 44dd2d39420fe6188f78901033fa2256c7f7db56 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
#!/bin/sh

set -e

MAILDIR=/srv/mail/$LOGNAME-d/

if [ -d "$MAILDIR/.spam.learn" ] ; then
	cd "$MAILDIR/.spam.learn"
	files=$(find -type f)
	if [ -n "$files" ] ; then
		sa-learn --spam $files > /dev/null 2>&1
		if [ -d "$HOME/.bogofilter" ]; then
			bogofilter --register-spam -B $files
		fi
		for file in $files ;do
			mv $file $MAILDIR/.spam.learned/$file
		done
	fi
fi