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.
4 PATH=$HOME/bin:/usr/local/bin:/usr/bin:/bin
11 PMVAR=$HOME/.var/procmail
12 MAILFILT=$HOME/.etc/mailfilter
15 REPLIES=$MAILFILT/autoreplies
17 LOGFILE=${LOGFILE:-$PMVAR/log}
20 NICE='/usr/bin/nice -20'
22 PROCMAIL="$NICE /usr/bin/procmail -p $PMDIR/procmailrc"
23 FORMAIL="$NICE /usr/bin/formail -f"
24 EGREP="$NICE /bin/egrep"
27 CRM114="$NICE /usr/share/crm114/mailreaver.crm -u $MAILFILT/crm114/"
28 SA_PREFS="$MAILFILT/spamassassin/user_prefs"
29 SPAMASSASSIN="$NICE /usr/bin/spamassassin -p $SA_PREFS"
30 #SPAMC="$NICE /usr/bin/spamc -lxu $ID"
32 TRAINER="$MAILFILT/bin/train"
35 OURDATE_SHORT=`date +%Y.%m.%d.%H.%m.%N`
40 ORGMAIL=$HOME/BOUNCED-MAIL
42 # maximum message size for spam checking
43 SPAMCHECK_MAX_MESSAGE_SIZE=2500000
45 # if crm114 is unsure and SA returns a score less-than-or-equal to this,
46 # autotrain crm114 with ham
47 CRM_UNSURE_SA_AUTOTRAIN_LIMIT_HAM=2.0
48 # if crm114 classifies a message as spam but SA returns a score
49 # less-than-or-equal to this, retrain crm114
50 CRM_MISCLASSIFY_SA_AUTOTRAIN_LIMIT_HAM=-1.0
51 # if crm114 is unsure and SA returns a score greater than this, autotrain
53 CRM_UNSURE_SA_AUTOTRAIN_LIMIT_SPAM=8.0
54 # if crm114 classifies a message as ham but SA returns a score
55 # greate than this, retrain crm114
56 CRM_MISCLASSIFY_SA_AUTOTRAIN_LIMIT_SPAM=11
58 ### constants used in rules
61 RE_MYDOMAIN="(.+\.)?madduck\.net"
62 RE_MAILRELAYS="(seamus|clegg)\.madduck\.net"
63 RE_SPACE_NEWLINE="(^|[ ])"
64 RE_FIRSTNAME="martin($RE_SPACE_NEWLINE+f(\.?|elix))?"
66 RE_EXTRACT_HEADER_VALUE="[ ]*\/[^ ].*"
69 DISCARD=$INBOX/.discard/
71 ### variables from the message
73 ### local recipient data
74 # user+foobar@my.domain.org
80 USER="${USER:-$LOGNAME}"
81 EXTENSION="${EXTENSION:-}"
82 LOCAL="${LOCAL:-$USER${EXTENSION:++$EXTENSION}}"
83 HOSTNAME="`hostname --fqdn`"
84 DOMAIN="${DOMAIN:-$HOSTNAME}"
85 RECIPIENT="${RECIPIENT:-$LOCAL@$DOMAIN}"
86 ID="$LOGNAME@$HOSTNAME"
89 INCLUDERC=$PMDIR/get-msgid
91 # if $SENDER is undefined or not an email address, get it from the message
94 *$ ^Sender:$RE_EXTRACT_HEADER_VALUE
98 *$ ^Date:$RE_EXTRACT_HEADER_VALUE
102 *$ ^From:$RE_EXTRACT_HEADER_VALUE
106 *$ ^Subject:$RE_EXTRACT_HEADER_VALUE
109 # TODO: can be removed as soon as albatross is out of the loop
111 * ^X-Original-To-Saved: \/.*
112 |$FORMAIL -R X-Original-To-Saved X-Original-To
115 *$ ^X-Original-To:$RE_EXTRACT_HEADER_VALUE
116 { ORIGINAL_TO="$MATCH" }
118 { LOG="NO ORIGINAL_TO: $MSGID" }
120 # fix variable values for special cases
121 INCLUDERC=$PMDIR/normalise
124 * ORIGINAL_TO ?? ^\/[^@]+
125 { ORIG_LOCAL="$MATCH" }
128 * ORIGINAL_TO ?? .+@\/.+
129 { ORIG_DOMAIN="$MATCH" }
131 ### run-time variables
134 # a procmail-style flag, which is true if unset and false if set (to !).
135 # unset by marknew if the message has already been seen by the filter (according
136 # to the X-Been-There header).
140 # if set, cuases spamchecks to be skipped, value lists reason
144 # set by spamtrapped and eqdomains and used to bypass spamchecks and handle as
145 # spam immediately. The value identifies who unset the variable.
149 # if set, then the mailfilter is as sure as it gets that the message is spam.
150 # The value identifies who set the variable.
154 # if set, then the various spamchecks disagree about spaminess of the mail.
155 # The value can hold additional information.
159 # if set, then the various spamchecks are unsure about spaminess of the mail.
160 # The value can hold additional information.
164 # if set, the spamchecks were skipped. The value gives the reason for
169 # if set, causes spamfilters to be retrained, according to the variable's value