summaryrefslogtreecommitdiff
path: root/learn-ham
blob: 6a345a8ff405d9ac246cc227a5a4944420846fc0 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
#!/bin/sh

set -e

for dir in \
	/srv/mail/$LOGNAME-d/ \
	$HOME/Maildir \
	; do

	MAILDIR="$dir"
	if [ -d "$MAILDIR/.spam.learn" ] ; then
		break
	fi
done

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