summaryrefslogtreecommitdiff
path: root/tools/mail-zap
blob: 4467ef6c46bd7a155bdca91952f8ab5aec9603f0 (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
#! /bin/bash

todo=""
verb="--spam"
dest="spam"

for arg in "$@" ; do
  case "$arg" in 
    -r) verb="--forget"
        dest="new"
        ;;
    *)  todo="$todo $arg"
  esac
done

if test -z "$todo" ; then
  exit
fi

mail-scan +subject $todo

sa-learn $verb $todo

for file in $todo ; do
  mv "$file" "$(dirname $file)/../$dest/"
done