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"
29 DELIVER="$NICE /usr/lib/dovecot/deliver"
31 CRM114="$NICE /usr/share/crm114/mailreaver.crm -u $MAILFILT/crm114/"
32 SA_PREFS="$MAILFILT/spamassassin/user_prefs"
33 SPAMASSASSIN="$NICE /usr/bin/spamassassin --prefs-file=$SA_PREFS"
34 SPAMC="$NICE /usr/bin/spamc --log-to-stderr --no-safe-fallback"
35 #SPAMC="$SPAMASSASSIN"
36 TRAINER="$NICE $MAILFILT/bin/train"
38 SQLITE="$NICE /usr/bin/sqlite3"
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=0.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"
69 RE_SPACE_NEWLINE="(^|$RE_SPACE)"
70 RE_FIRSTNAME="martin($RE_SPACE_NEWLINE+f(\.?|elix))?"
72 RE_EXTRACT_HEADER_VALUE="$RE_SPACE*\/$RE_NOT_SPACE.*"
74 DEJAVU_HEADER=X-Deja-Vu
77 DELAYED_QUEUE=$BASE/.delayed/
78 TICKLER_QUEUE=$BASE/.store/
79 DISCARD=$BASE/.discard/
81 #DISCARD="'|$DELIVER -m BASE.discard'"
83 DELAY_NEXT_WEEKEND='next sunday 28 hours ago' # fri night, 20:00
84 DELAY_TONIGHT='tomorrow 00:00 4 hours ago' # tonight at 20:00
86 OURDATE="`$BIN_DATE +'%s %Y.%m.%d.%H.%M.%N %a, %d %b %Y %T %z'`"
88 *$ OURDATE ?? ^\/${RE_NOT_SPACE}+
89 { OURDATE_TS="$MATCH" }
91 *$ OURDATE ?? ^[0-9]+${RE_SPACE}+\/${RE_NOT_SPACE}+
92 { OURDATE_SHORT="$MATCH" }
94 *$ OURDATE ?? ^[0-9]+${RE_SPACE}+[0-9.]+${RE_SPACE}+\/.+
97 ### variables from the message
99 ### local recipient data
100 # user+foobar@my.domain.org
106 USER="${USER:-$LOGNAME}"
107 EXTENSION="${EXTENSION:-}"
108 LOCAL="${LOCAL:-$USER${EXTENSION:++$EXTENSION}}"
109 HOSTNAME="`hostname --fqdn`"
110 DOMAIN="${DOMAIN:-$HOSTNAME}"
111 RECIPIENT="${RECIPIENT:-$LOCAL@$DOMAIN}"
112 ID="$LOGNAME@$HOSTNAME"
115 INCLUDERC=$PMDIR/get-msgid
117 # if $SENDER is undefined or not an email address, get it from the message
120 *$ ^Sender:$RE_EXTRACT_HEADER_VALUE
124 *$ ^Date:$RE_EXTRACT_HEADER_VALUE
128 *$ ^From:$RE_EXTRACT_HEADER_VALUE
132 *$ ^Subject:$RE_EXTRACT_HEADER_VALUE
136 # mimedecode.c: * Disclaimer: We only handle charset of iso-8859-1
138 * SUBJECT ?? ^=\?iso-8859-1\?[QB]\?.+\?=$
140 DECODED="`echo Subject: $SUBJECT | mimedecode | iconv -f latin1 -t utf-8`"
142 *$ DECODED ?? ^Subject:$RE_EXTRACT_HEADER_VALUE
148 *$ ^X-Original-To:$RE_EXTRACT_HEADER_VALUE
149 { ORIGINAL_TO="$MATCH" }
152 { LOG="NO ORIGINAL_TO: $MSGID" }
155 *$ ^X-Trained-As:$RE_EXTRACT_HEADER_VALUE
156 { TRAINED_AS="$MATCH" }
159 *$ ^X-Postponed:$RE_EXTRACT_HEADER_VALUE
160 { POSTPONED="$MATCH" }
162 # fix variable values for special cases
163 INCLUDERC=$PMDIR/normalise
166 * ORIGINAL_TO ?? ^\/[^@]+
167 { ORIG_LOCAL="$MATCH" }
170 * ORIGINAL_TO ?? .+@\/.+
171 { ORIG_DOMAIN="$MATCH" }
173 ### run-time variables
176 # a procmail-style flag, which is true if unset and false if set (to !).
177 # unset by dejavu if the message has already been seen by the filter (according
178 # to the X-Been-There header).
182 # set this to a folder if the message should be delivered elsewhere than the
187 # if set, cuases spamchecks to be skipped, value lists reason
191 # set by spamtrapped and eqdomains and used to bypass spamchecks and handle as
192 # spam immediately. The value identifies who unset the variable.
196 # if set, then the mailfilter is as sure as it gets that the message is spam.
197 # The value identifies who set the variable.
201 # if set, then the various spamchecks disagree about spaminess of the mail.
202 # The value can hold additional information.
206 # if set, then the various spamchecks are unsure about spaminess of the mail.
207 # The value can hold additional information.
211 # if set, the spamchecks were skipped. The value gives the reason for
216 # if set, causes spamfilters to be retrained, according to the variable's value
220 # if set, contains reason why justme message was passed
224 # if set, disables delaying messages