]> 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:

initial checkin
[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 # 4a. message needs to be retrained as spam
16 #     symptom:  $CRM_RETRAIN is set to spam
17 #     reaction: retrain filters, report, and file as spam
18 #
19 # 4b.  message is spamtrapped
20 #     symptom:  $SPAMTRAPPED is set
21 #     reaction: train filters, report, and file as spam
22 #
23 # 5.  message needs to be retrained as ham
24 #     symptom:  $CRM_RETRAIN is set to ham
25 #     reaction: retrain crm114 and resubmit the message to the spamfilter
26 #
27 # 6.  spam degree is unknown:
28 #     symptom:  $SPAM_UNKNOWN contains the reason for skipping the checks
29 #     reaction: pass the message
30 #
31 # 7.  message is not spam
32 #     symptom:  none of the above
33 #     reaction: pass the message
34 #
35
36 :0
37 * SPAM_UNSURE ?? .
38 {
39   LOG="spamfilter:  filing as unsure$NL"
40   :0
41   $INBOX/.retrain.unsure/
42 }
43
44 :0 E
45 * SPAM_DISAGREE ?? .
46 {
47   LOG="spamfilter:  filing as disagreed$NL"
48   :0
49   $INBOX/.retrain.disagree/
50 }
51
52 :0 E
53 * 1^0 CRM_RETRAIN ?? spam
54 * 1^0 SPAMTRAPPED ?? .
55 {
56   LOG="spamfilter:  (re)training as spam$NL"
57   :0 fw
58   |$TRAINER --spam 2>/dev/null
59   IS_SPAM=trained
60 }
61
62 :0 E
63 * CRM_RETRAIN ?? ham
64 {
65   LOG="spamfilter:  retraining as ham$NL"
66   :0 fw
67   |$TRAINER --ham 2>/dev/null
68 #  :0
69 #  |$TRAINER --ham 2>/dev/null | $PROCMAIL
70 }
71
72 # not using flag E because IS_SPAM could have been set further up
73 :0
74 * IS_SPAM ?? .
75 {
76   LOG="spamfilter:  filing as spam$NL"
77   :0
78   $INBOX/.spam/
79 }
80
81 :0
82 { LOG="spamfilter:  allowed to pass$NL" }
83
84 #:0 E
85 #*$ $SPAM_UNKNOWN
86 #{ do nothing }
87
88 #:0 E
89 #{ do nothing}