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}
22 #NICE='/usr/bin/nice -20'
24 PROCMAIL="$NICE /usr/bin/procmail -p $PMDIR/procmailrc"
25 FORMAIL="$NICE /usr/bin/formail -f"
26 EGREP="$NICE /bin/egrep"
28 DELIVER="$NICE /usr/lib/dovecot/deliver"
30 CRM114="$NICE /usr/share/crm114/mailreaver.crm -u $MAILFILT/crm114/"
31 SA_PREFS="$MAILFILT/spamassassin/user_prefs"
32 SPAMASSASSIN="$NICE /usr/bin/spamassassin --prefs-file=$SA_PREFS"
33 SPAMC="$NICE /usr/bin/spamc --log-to-stderr --no-safe-fallback"
34 #SPAMC="$SPAMASSASSIN"
35 TRAINER="$MAILFILT/bin/train"
38 OURDATE_SHORT=`date +%Y.%m.%d.%H.%M.%N`
44 ORGMAIL=$HOME/BOUNCED-MAIL
46 # maximum message size for spam checking
47 SPAMCHECK_MAX_MESSAGE_SIZE=512000
49 # if crm114 is unsure and SA returns a score less-than-or-equal to this,
50 # autotrain crm114 with ham
51 CRM_UNSURE_SA_AUTOTRAIN_LIMIT_HAM=2.0
52 # if crm114 classifies a message as spam but SA returns a score
53 # less-than-or-equal to this, retrain crm114
54 CRM_MISCLASSIFY_SA_AUTOTRAIN_LIMIT_HAM=-1.0
55 # if crm114 is unsure and SA returns a score greater than this, autotrain
57 CRM_UNSURE_SA_AUTOTRAIN_LIMIT_SPAM=8.0
58 # if crm114 classifies a message as ham but SA returns a score
59 # greate than this, retrain crm114
60 CRM_MISCLASSIFY_SA_AUTOTRAIN_LIMIT_SPAM=11
62 ### constants used in rules
65 RE_MYDOMAIN="(.+\.)*madduck\.net"
66 RE_MAILRELAYS="(seamus|clegg)\.madduck\.net"
68 RE_SPACE_NEWLINE="(^|$RE_SPACE)"
69 RE_FIRSTNAME="martin($RE_SPACE_NEWLINE+f(\.?|elix))?"
71 RE_EXTRACT_HEADER_VALUE="[ ]*\/[^ ].*"
73 DEJAVU_HEADER=X-Deja-Vu
76 DISCARD=$BASE/.discard/
77 #DISCARD="'|$DELIVER -m BASE.discard'"
79 ### variables from the message
81 ### local recipient data
82 # user+foobar@my.domain.org
88 USER="${USER:-$LOGNAME}"
89 EXTENSION="${EXTENSION:-}"
90 LOCAL="${LOCAL:-$USER${EXTENSION:++$EXTENSION}}"
91 HOSTNAME="`hostname --fqdn`"
92 DOMAIN="${DOMAIN:-$HOSTNAME}"
93 RECIPIENT="${RECIPIENT:-$LOCAL@$DOMAIN}"
94 ID="$LOGNAME@$HOSTNAME"
97 INCLUDERC=$PMDIR/get-msgid
99 # if $SENDER is undefined or not an email address, get it from the message
102 *$ ^Sender:$RE_EXTRACT_HEADER_VALUE
106 *$ ^Date:$RE_EXTRACT_HEADER_VALUE
110 *$ ^From:$RE_EXTRACT_HEADER_VALUE
114 *$ ^Subject:$RE_EXTRACT_HEADER_VALUE
118 *$ ^X-Original-To:$RE_EXTRACT_HEADER_VALUE
119 { ORIGINAL_TO="$MATCH" }
121 { LOG="NO ORIGINAL_TO: $MSGID" }
123 # fix variable values for special cases
124 INCLUDERC=$PMDIR/normalise
127 * ORIGINAL_TO ?? ^\/[^@]+
128 { ORIG_LOCAL="$MATCH" }
131 * ORIGINAL_TO ?? .+@\/.+
132 { ORIG_DOMAIN="$MATCH" }
134 ### run-time variables
137 # a procmail-style flag, which is true if unset and false if set (to !).
138 # unset by dejavu if the message has already been seen by the filter (according
139 # to the X-Been-There header).
143 # set this to a folder if the message should be delivered elsewhere than the
148 # if set, cuases spamchecks to be skipped, value lists reason
152 # set by spamtrapped and eqdomains and used to bypass spamchecks and handle as
153 # spam immediately. The value identifies who unset the variable.
157 # if set, then the mailfilter is as sure as it gets that the message is spam.
158 # The value identifies who set the variable.
162 # if set, then the various spamchecks disagree about spaminess of the mail.
163 # The value can hold additional information.
167 # if set, then the various spamchecks are unsure about spaminess of the mail.
168 # The value can hold additional information.
172 # if set, the spamchecks were skipped. The value gives the reason for
177 # if set, causes spamfilters to be retrained, according to the variable's value
181 # if set, contains reason why justme message was passed
185 # if set, contains category with which this message has just been trained