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

proper handling of X-Postponed header
[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   { DEST=retrain.unsure }
38 }
39
40 :0 E
41 * SPAM_DISAGREE ?? .
42 {
43   LOG="spamfilter:  filing as disagreed$NL"
44   :0
45   { DEST=retrain.disagree }
46 }
47
48 :0 E
49 * RETRAIN ?? spam
50 {
51   LOG="spamfilter:  (re)training as spam$NL"
52   :0 fw
53   |$TRAINER --spam 2>/dev/null
54   IS_SPAM=trained
55 }
56
57 :0 E
58 * RETRAIN ?? ham
59 {
60   LOG="spamfilter:  retraining as ham$NL"
61   :0 fw
62   |$TRAINER --ham 2>/dev/null
63 #  :0
64 #  |$TRAINER --ham 2>/dev/null | $PROCMAIL
65 }
66
67 # not using flag E because IS_SPAM could have been set further up
68 :0
69 * IS_SPAM ?? .
70 {
71   LOG="spamfilter:  filing as spam$NL"
72   :0
73   $SPAM
74 }
75
76 :0 E
77 { LOG="spamfilter:  allowed to pass$NL" }
78
79 #:0 E
80 #*$ $SPAM_UNKNOWN
81 #{ do nothing }
82
83 #:0 E
84 #{ do nothing}