]> git.madduck.net Git - etc/mailfilter.git/blob - procmail/defines

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:

add smokecds.com
[etc/mailfilter.git] / procmail / defines
1 ### basic settings
2
3 SHELL=/bin/sh
4 PATH=$HOME/bin:/usr/local/bin:/usr/bin:/bin
5
6 COMSAT=no
7
8 LINEBUF=16384
9 UMASK=0077
10
11 PMVAR=$HOME/.var/procmail
12 MAILFILT=$HOME/.etc/mailfilter
13 PMRULES=$PMDIR/rules
14 CONF=$MAILFILT/config
15 REPLIES=$MAILFILT/autoreplies
16
17 LOGFILE=${LOGFILE:-$PMVAR/log}
18 LOGABSTRACT=no
19
20 LC_CTYPE=de_CH.UTF-8
21
22 #NICE='/usr/bin/nice -20'
23
24 PROCMAIL="$NICE /usr/bin/procmail -p $PMDIR/procmailrc"
25 FORMAIL="$NICE /usr/bin/formail -f"
26 GREP="$NICE /bin/grep"
27 EGREP="$NICE /bin/egrep"
28 FGREP="$NICE /bin/fgrep"
29 SED="$NICE /bin/sed"
30 BIN_DATE="/bin/date"
31 DELIVER="$NICE /usr/lib/dovecot/deliver"
32
33 CRM114="$NICE /usr/share/crm114/mailreaver.crm -u $MAILFILT/crm114/"
34 SA_PREFS="$MAILFILT/spamassassin/user_prefs"
35 SPAMASSASSIN="$NICE /usr/bin/spamassassin --prefs-file=$SA_PREFS"
36 SPAMC="$NICE /usr/bin/spamc --log-to-stderr --no-safe-fallback"
37 #SPAMC="$SPAMASSASSIN"
38 TRAINER="$NICE $MAILFILT/bin/train"
39
40 SQLITE="$NICE /usr/bin/sqlite3"
41
42 BASE=$HOME/.maildir
43
44 #DEFAULT="|$DELIVER"
45 DEFAULT=$BASE/
46 ORGMAIL=$HOME/BOUNCED-MAIL
47
48 # maximum message size for spam checking
49 SPAMCHECK_MAX_MESSAGE_SIZE=512000
50
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=0.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
58 # crm114 with spam
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
63
64 ### constants used in rules
65 NL="
66 "
67 RE_MYDOMAIN="(.+\.)*madduck\.net"
68 RE_MAILRELAYS="(seamus|clegg)\.madduck\.net"
69 RE_SPACE="[     ]"
70 RE_NOT_SPACE="[^        ]"
71 RE_SPACE_NEWLINE="(^|$RE_SPACE)"
72 RE_FIRSTNAME="martin($RE_SPACE_NEWLINE+f(\.?|elix))?"
73 RE_LASTNAME="kraff?t"
74 RE_EXTRACT_HEADER_VALUE="$RE_SPACE*\/$RE_NOT_SPACE.*"
75
76 DEJAVU_HEADER=X-Deja-Vu
77
78 NULL=/dev/null
79 DELAYED_QUEUE=$BASE/.delayed/
80 TICKLER_QUEUE=$BASE/.store/
81 DISCARD=$BASE/.discard/
82 SPAM=$BASE/.spam/
83 #DISCARD="'|$DELIVER -m BASE.discard'"
84
85 DELAY_NEXT_WEEKEND='next sunday 30 hours ago' # fri night, 18:00
86 DELAY_TONIGHT='tomorrow 00:00 4 hours ago' # tonight at 20:00
87 DELAY_AFTERNOON='tomorrow 00:00 5 hours ago' # today at 19:00
88
89 OURDATE="`$BIN_DATE +'%s %Y.%m.%d.%H.%M.%N %a, %d %b %Y %T %z'`"
90 :0
91 *$ OURDATE ?? ^\/${RE_NOT_SPACE}+
92 { OURDATE_TS="$MATCH" }
93 :0
94 *$ OURDATE ?? ^[0-9]+${RE_SPACE}+\/${RE_NOT_SPACE}+
95 { OURDATE_SHORT="$MATCH" }
96 :0
97 *$ OURDATE ?? ^[0-9]+${RE_SPACE}+[0-9.]+${RE_SPACE}+\/.+
98 { OURDATE="$MATCH" }
99
100 ### variables from the message
101
102 ### local recipient data
103 # user+foobar@my.domain.org
104 # <  >                       $USER
105 #      <    >                $EXTENSION
106 # <         >                $LOCAL
107 #             <           >  $DOMAIN
108 # <                       >  $RECIPIENT
109 USER="${USER:-$LOGNAME}"
110 EXTENSION="${EXTENSION:-}"
111 LOCAL="${LOCAL:-$USER${EXTENSION:++$EXTENSION}}"
112 HOSTNAME="`hostname --fqdn`"
113 DOMAIN="${DOMAIN:-$HOSTNAME}"
114 RECIPIENT="${RECIPIENT:-$LOCAL@$DOMAIN}"
115 ID="$LOGNAME@$HOSTNAME"
116
117 # message-id
118 INCLUDERC=$PMDIR/get-msgid
119
120 # if $SENDER is undefined or not an email address, get it from the message
121 :0
122 * !SENDER ?? @
123 *$ ^Sender:$RE_EXTRACT_HEADER_VALUE
124 { SENDER="$MATCH" }
125
126 :0
127 *$ ^Date:$RE_EXTRACT_HEADER_VALUE
128 { DATE="$MATCH" }
129
130 :0
131 *$ ^From:$RE_EXTRACT_HEADER_VALUE
132 { FROM="$MATCH" }
133
134 :0
135 *$ ^Subject:$RE_EXTRACT_HEADER_VALUE
136 {
137   SUBJECT=$MATCH
138
139   # mimedecode.c: * Disclaimer: We only handle charset of iso-8859-1
140   :0
141   * SUBJECT ?? =\?iso-8859-1\?[QBqb]\?.+\?=
142   {
143     DECODED="`echo Subject: $SUBJECT | mimedecode | iconv -f latin1 -t utf-8`"
144     :0
145     *$ DECODED ?? ^Subject:$RE_EXTRACT_HEADER_VALUE
146     { SUBJECT=$MATCH }
147   }
148 }
149
150 :0
151 *$ ^X-Original-To:$RE_EXTRACT_HEADER_VALUE
152 { ORIGINAL_TO="$MATCH" }
153 :0 E
154 * ^Received:
155 { LOGLATER="NO ORIGINAL_TO: $MSGID" }
156
157 :0
158 *$ ^X-Trained-As:$RE_EXTRACT_HEADER_VALUE
159 { TRAINED_AS="$MATCH" }
160
161 :0
162 *$ ^X-Postponed:$RE_EXTRACT_HEADER_VALUE
163 { POSTPONED="$MATCH" }
164
165 # fix variable values for special cases
166 INCLUDERC=$PMDIR/normalise
167
168 :0
169 * ORIGINAL_TO ?? ^\/[^@]+
170 { ORIG_LOCAL="$MATCH" }
171
172 :0
173 * ORIGINAL_TO ?? .+@\/.+
174 { ORIG_DOMAIN="$MATCH" }
175
176 ### run-time variables
177
178 # MSG_DEJAVU
179 # a procmail-style flag, which is true if unset and false if set (to !).
180 # unset by dejavu if the message has already been seen by the filter (according
181 # to the X-Been-There header).
182 MSG_DEJAVU=!
183
184 # DEST
185 # set this to a folder if the message should be delivered elsewhere than the
186 # default
187 DEST
188
189 # SKIP_SPAMCHECKS
190 # if set, cuases spamchecks to be skipped, value lists reason
191 SKIP_SPAMCHECKS
192
193 # SPAMTRAPPED
194 # set by spamtrapped and eqdomains and used to bypass spamchecks and handle as
195 # spam immediately. The value identifies who unset the variable.
196 SPAMTRAPPED
197
198 # IS_SPAM
199 # if set, then the mailfilter is as sure as it gets that the message is spam.
200 # The value identifies who set the variable.
201 IS_SPAM
202
203 # SPAM_DISAGREE
204 # if set, then the various spamchecks disagree about spaminess of the mail.
205 # The value can hold additional information.
206 SPAM_DISAGREE
207
208 # SPAM_UNSURE
209 # if set, then the various spamchecks are unsure about spaminess of the mail.
210 # The value can hold additional information.
211 SPAM_UNSURE
212
213 # SPAM_UNKNOWN
214 # if set, the spamchecks were skipped. The value gives the reason for
215 # skipping.
216 SPAM_UNKNOWN
217
218 # RETRAIN
219 # if set, causes spamfilters to be retrained, according to the variable's value
220 RETRAIN
221
222 # JUSTME
223 # if set, contains reason why justme message was passed
224 JUSTME
225
226 # DISABLE_DELAYS
227 # if set, disables delaying messages
228 DISABLE_DELAYS
229
230 # DELAY
231 # argument to /bin/date -d to indicate a message delay. This is overridden by
232 # RELEASE
233 DELAY
234
235 # RELEASE
236 # /bin/date time expression indicating the time at which a message is to be
237 # released. Overrides DELAY.
238 RELEASE
239
240 # vim:ft=procmail