]> git.madduck.net Git - etc/mailfilter.git/blob - procmail/handlespam

madduck's git repository

Every one of the projects in this repository is available at the canonical URL git://git.madduck.net/madduck/pub/<projectpath> — see each project's metadata for the exact URL.

All patches and comments are welcome. Please squash your changes to logical commits before using git-format-patch and git-send-email to patches@git.madduck.net. If you'd read over the Git project's submission guidelines and adhered to them, I'd be especially grateful.

SSH access, as well as push access can be individually arranged.

If you use my repositories frequently, consider adding the following snippet to ~/.gitconfig and using the third clone URL listed for each project:

[url "git://git.madduck.net/madduck/"]
  insteadOf = madduck:

do not search headers for keywords
[etc/mailfilter.git] / procmail / handlespam
1 # we are called from spamfilter and the following cases could be:
2 #
3 # 1.  spamfilters are unsure
4 #     symptom:  $SPAM_UNSURE is set (sa-unsure)
5 #     reaction: file as unsure
6 #
7 # 2.  spamfilters disagree
8 #     symptom:  $SPAM_DISAGREE is set (sa-ham or sa-spam)
9 #     reaction: file as disagreed
10 #
11 # 3.  message is spam for sure
12 #     symptom:  $IS_SPAM is set
13 #     reaction: file as spam
14 #
15 # 4. message needs to be retrained as spam
16 #     symptom:  $RETRAIN is set to spam
17 #     reaction: retrain filters, report, and file as spam
18 #
19 # 5.  message needs to be retrained as ham
20 #     symptom:  $RETRAIN is set to ham
21 #     reaction: retrain crm114 and resubmit the message to the spamfilter
22 #
23 # 6.  spam degree is unknown:
24 #     symptom:  $SPAM_UNKNOWN contains the reason for skipping the checks
25 #     reaction: pass the message
26 #
27 # 7.  message is not spam
28 #     symptom:  none of the above
29 #     reaction: pass the message
30 #
31
32 :0
33 * SPAM_UNSURE ?? .
34 {
35   LOG="spamfilter:  filing as unsure$NL"
36   :0
37   {
38     DEST=retrain.unsure
39     DELAY=$DELAY_TONIGHT
40   }
41 }
42
43 :0 E
44 * SPAM_DISAGREE ?? .
45 {
46   LOG="spamfilter:  filing as disagreed$NL"
47   :0
48   {
49     DEST=retrain.disagree
50     DELAY=$DELAY_TONIGHT
51   }
52 }
53
54 :0 E
55 * RETRAIN ?? spam
56 {
57   LOG="spamfilter:  (re)training as spam$NL"
58   :0 fw
59   |$TRAINER --spam 2>/dev/null
60   IS_SPAM=trained
61 }
62
63 :0 E
64 * RETRAIN ?? ham
65 {
66   LOG="spamfilter:  retraining as ham$NL"
67   :0 fw
68   |$TRAINER --ham 2>/dev/null
69 #  :0
70 #  |$TRAINER --ham 2>/dev/null | $PROCMAIL
71 }
72
73 # not using flag E because IS_SPAM could have been set further up
74 :0
75 * IS_SPAM ?? .
76 {
77   LOG="spamfilter:  filing as spam$NL"
78   :0
79   $SPAM
80 }
81
82 :0 E
83 { LOG="spamfilter:  allowed to pass$NL" }
84
85 #:0 E
86 #*$ $SPAM_UNKNOWN
87 #{ do nothing }
88
89 #:0 E
90 #{ do nothing}