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="$NICE $MAILFILT/bin/train"
37 SQLITE="$NICE /usr/bin/sqlite3"
40 OURDATE_SHORT=`date +%Y.%m.%d.%H.%M.%N`
46 ORGMAIL=$HOME/BOUNCED-MAIL
48 # maximum message size for spam checking
49 SPAMCHECK_MAX_MESSAGE_SIZE=512000
51 # if crm114 is unsure and SA returns a score less-than-or-equal to this,
52 # autotrain crm114 with ham
53 CRM_UNSURE_SA_AUTOTRAIN_LIMIT_HAM=2.0
54 # if crm114 classifies a message as spam but SA returns a score
55 # less-than-or-equal to this, retrain crm114
56 CRM_MISCLASSIFY_SA_AUTOTRAIN_LIMIT_HAM=-1.0
57 # if crm114 is unsure and SA returns a score greater than this, autotrain
59 CRM_UNSURE_SA_AUTOTRAIN_LIMIT_SPAM=8.0
60 # if crm114 classifies a message as ham but SA returns a score
61 # greate than this, retrain crm114
62 CRM_MISCLASSIFY_SA_AUTOTRAIN_LIMIT_SPAM=11
64 ### constants used in rules
67 RE_MYDOMAIN="(.+\.)*madduck\.net"
68 RE_MAILRELAYS="(seamus|clegg)\.madduck\.net"
71 RE_SPACE_NEWLINE="(^|$RE_SPACE)"
72 RE_FIRSTNAME="martin($RE_SPACE_NEWLINE+f(\.?|elix))?"
74 RE_EXTRACT_HEADER_VALUE="$RE_SPACE*\/$RE_NOT_SPACE.*"
76 DEJAVU_HEADER=X-Deja-Vu
79 DELAYED_QUEUE=$BASE/.delayed/
80 TICKLER_QUEUE=$BASE/.tickler/
81 DISCARD=$BASE/.discard/
82 #DISCARD="'|$DELIVER -m BASE.discard'"
84 ### variables from the message
86 ### local recipient data
87 # user+foobar@my.domain.org
93 USER="${USER:-$LOGNAME}"
94 EXTENSION="${EXTENSION:-}"
95 LOCAL="${LOCAL:-$USER${EXTENSION:++$EXTENSION}}"
96 HOSTNAME="`hostname --fqdn`"
97 DOMAIN="${DOMAIN:-$HOSTNAME}"
98 RECIPIENT="${RECIPIENT:-$LOCAL@$DOMAIN}"
99 ID="$LOGNAME@$HOSTNAME"
102 INCLUDERC=$PMDIR/get-msgid
104 # if $SENDER is undefined or not an email address, get it from the message
107 *$ ^Sender:$RE_EXTRACT_HEADER_VALUE
111 *$ ^Date:$RE_EXTRACT_HEADER_VALUE
115 *$ ^From:$RE_EXTRACT_HEADER_VALUE
119 *$ ^Subject:$RE_EXTRACT_HEADER_VALUE
123 *$ ^X-Original-To:$RE_EXTRACT_HEADER_VALUE
124 { ORIGINAL_TO="$MATCH" }
126 { LOG="NO ORIGINAL_TO: $MSGID" }
129 *$ ^X-Trained-As:$RE_EXTRACT_HEADER_VALUE
130 { TRAINED_AS="$MATCH" }
133 *$ ^X-Tickle-Delivered:$RE_EXTRACT_HEADER_VALUE
134 { TICKLE_DELIVERED="$MATCH" }
136 # fix variable values for special cases
137 INCLUDERC=$PMDIR/normalise
140 * ORIGINAL_TO ?? ^\/[^@]+
141 { ORIG_LOCAL="$MATCH" }
144 * ORIGINAL_TO ?? .+@\/.+
145 { ORIG_DOMAIN="$MATCH" }
147 ### run-time variables
150 # a procmail-style flag, which is true if unset and false if set (to !).
151 # unset by dejavu if the message has already been seen by the filter (according
152 # to the X-Been-There header).
156 # set this to a folder if the message should be delivered elsewhere than the
161 # if set, cuases spamchecks to be skipped, value lists reason
165 # set by spamtrapped and eqdomains and used to bypass spamchecks and handle as
166 # spam immediately. The value identifies who unset the variable.
170 # if set, then the mailfilter is as sure as it gets that the message is spam.
171 # The value identifies who set the variable.
175 # if set, then the various spamchecks disagree about spaminess of the mail.
176 # The value can hold additional information.
180 # if set, then the various spamchecks are unsure about spaminess of the mail.
181 # The value can hold additional information.
185 # if set, the spamchecks were skipped. The value gives the reason for
190 # if set, causes spamfilters to be retrained, according to the variable's value
194 # if set, contains reason why justme message was passed