]> 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:

ignore gmx mailings
[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 VACATION="$NICE /usr/bin/vacation"
41
42 SQLITE="$NICE /usr/bin/sqlite3"
43
44 BASE=$HOME/.maildir
45
46 #DEFAULT="|$DELIVER"
47 DEFAULT=$BASE/
48 ORGMAIL=$HOME/BOUNCED-MAIL
49
50 # maximum message size for spam checking
51 SPAMCHECK_MAX_MESSAGE_SIZE=512000
52
53 # if crm114 is unsure and SA returns a score less-than-or-equal to this,
54 # autotrain crm114 with ham
55 CRM_UNSURE_SA_AUTOTRAIN_LIMIT_HAM=0.0
56 # if crm114 classifies a message as spam but SA returns a score
57 # less-than-or-equal to this, retrain crm114
58 CRM_MISCLASSIFY_SA_AUTOTRAIN_LIMIT_HAM=-1.0
59 # if crm114 is unsure and SA returns a score greater than this, autotrain
60 # crm114 with spam
61 CRM_UNSURE_SA_AUTOTRAIN_LIMIT_SPAM=8.0
62 # if crm114 classifies a message as ham but SA returns a score
63 # greate than this, retrain crm114
64 CRM_MISCLASSIFY_SA_AUTOTRAIN_LIMIT_SPAM=11
65
66 ### constants used in rules
67 NL="
68 "
69 RE_MYDOMAIN="(.+\.)*madduck\.net"
70 RE_MAILRELAYS="(seamus|swan|clegg)\.madduck\.net"
71 RE_SPACE="[     ]"
72 RE_NOT_SPACE="[^        ]"
73 RE_SPACE_NEWLINE="(^|$RE_SPACE)"
74 RE_FIRSTNAME="martin($RE_SPACE_NEWLINE+f(\.?|elix))?"
75 RE_LASTNAME="kraff?t"
76 RE_EXTRACT_HEADER_VALUE="$RE_SPACE*\/$RE_NOT_SPACE.*"
77 RE_EMAILADDRESS="${RE_NOT_SPACE}+@${RE_NOT_SPACE}+\.[^  >]+"
78
79 DEJAVU_HEADER=X-Deja-Vu
80
81 NULL=/dev/null
82 DELAYED_QUEUE=$BASE/.delayed/
83 TICKLER_QUEUE=$BASE/.store/
84 DISCARD=$BASE/.discard/
85 SPAM=$BASE/.spam/
86 #DISCARD="'|$DELIVER -m BASE.discard'"
87
88 DELAY_NEXT_WEEKEND='next sunday 28 hours ago' # fri night, 20:00
89 DELAY_TONIGHT='tomorrow 00:00 4 hours ago' # tonight at 20:00
90 DELAY_AFTERNOON='tomorrow 00:00 8 hours ago' # today at 16:00
91
92 OURDATE="`$BIN_DATE +'%s %Y%m%d.%H%M.%N %a, %d %b %Y %T %z'`"
93 :0
94 *$ OURDATE ?? ^\/${RE_NOT_SPACE}+
95 { OURDATE_TS="$MATCH" }
96 :0
97 *$ OURDATE ?? ^[0-9]+${RE_SPACE}+\/${RE_NOT_SPACE}+
98 { OURDATE_SHORT="$MATCH" }
99 :0
100 *$ OURDATE ?? ^[0-9]+${RE_SPACE}+[0-9.]+${RE_SPACE}+\/.+
101 { OURDATE="$MATCH" }
102
103 ### variables from the message
104
105 ### local recipient data
106 # user+foobar@my.domain.org
107 # <  >                       $USER
108 #      <    >                $EXTENSION
109 # <         >                $LOCAL
110 #             <           >  $DOMAIN
111 # <                       >  $RECIPIENT
112 USER="${USER:-$LOGNAME}"
113 EXTENSION="${EXTENSION:-}"
114 LOCAL="${LOCAL:-$USER${EXTENSION:++$EXTENSION}}"
115 HOSTNAME="`hostname --fqdn`"
116 DOMAIN="${DOMAIN:-$HOSTNAME}"
117 RECIPIENT="${RECIPIENT:-$LOCAL@$DOMAIN}"
118 ID="$LOGNAME@$HOSTNAME"
119
120 # message-id
121 INCLUDERC=$PMDIR/get-msgid
122
123 :0
124 *$ ^From:$RE_EXTRACT_HEADER_VALUE
125 { FROM="$MATCH" }
126
127 :0
128 * FROM ?? ^.+<\/.+@[^>]+
129 { FROMEMAIL="$MATCH" }
130
131 :0 E
132 * FROM ?? ^.+\(\/.+@[^\)]+
133 { FROMEMAIL="$MATCH" }
134
135 :0 E
136 *$ FROM ?? ^\/$RE_EMAILADDRESS
137 { FROMEMAIL="$MATCH" }
138
139 :0
140 * FROMEMAIL ?? ^".+"$
141 * FROMEMAIL ?? ^"\/[^"]+
142 { FROMEMAIL="$MATCH" }
143
144 # if $SENDER is undefined or not an email address, get it from the message
145 :0
146 * !SENDER ?? @
147 {
148   :0
149   *$ ^Sender:$RE_EXTRACT_HEADER_VALUE
150   { SENDER="$MATCH" }
151
152   :0 E
153   { SENDER="$FROMEMAIL" }
154 }
155
156 :0
157 *$ ^Date:$RE_EXTRACT_HEADER_VALUE
158 { DATE="$MATCH" }
159
160 :0
161 *$ ^Subject:$RE_EXTRACT_HEADER_VALUE
162 {
163   SUBJECT="$MATCH"
164
165   :0
166   * SUBJECT ?? =\?.+\?[QBqb]\?.+\?=
167   {
168     SUBJECT="`PERL_UNICODE=S perl -MEncode=decode -e \"print decode(\\\"MIME-Header\\\", \\\"$SUBJECT\\\") . \\\"\n\\\";\"`"
169     SUBJECT_ENCODED="$MATCH"
170   }
171 }
172
173 :0
174 *$ ^X-Original-To:$RE_EXTRACT_HEADER_VALUE
175 { ORIGINAL_TO="$MATCH" }
176 :0 E
177 * ^Received:
178 { LOGLATER="NO ORIGINAL_TO: $MSGID" }
179
180 :0
181 *$ ^X-Trained-As:$RE_EXTRACT_HEADER_VALUE
182 { TRAINED_AS="$MATCH" }
183
184 :0
185 *$ ^X-Postponed:$RE_EXTRACT_HEADER_VALUE
186 { POSTPONED="$MATCH" }
187
188 # fix variable values for special cases
189 INCLUDERC=$PMDIR/normalise
190
191 :0
192 * ORIGINAL_TO ?? ^\/[^@]+
193 { ORIG_LOCAL="$MATCH" }
194
195 :0
196 * ORIGINAL_TO ?? .+@\/.+
197 { ORIG_DOMAIN="$MATCH" }
198
199 ### run-time variables
200
201 # MSG_DEJAVU
202 # a procmail-style flag, which is true if unset and false if set (to !).
203 # unset by dejavu if the message has already been seen by the filter (according
204 # to the X-Been-There header).
205 MSG_DEJAVU=!
206
207 # DEST
208 # set this to a folder if the message should be delivered elsewhere than the
209 # default
210 DEST
211
212 # SKIP_SPAMCHECKS
213 # if set, cuases spamchecks to be skipped, value lists reason
214 SKIP_SPAMCHECKS
215
216 # SPAMTRAPPED
217 # set by spamtrapped and eqdomains and used to bypass spamchecks and handle as
218 # spam immediately. The value identifies who unset the variable.
219 SPAMTRAPPED
220
221 # IS_SPAM
222 # if set, then the mailfilter is as sure as it gets that the message is spam.
223 # The value identifies who set the variable.
224 IS_SPAM
225
226 # SPAM_DISAGREE
227 # if set, then the various spamchecks disagree about spaminess of the mail.
228 # The value can hold additional information.
229 SPAM_DISAGREE
230
231 # SPAM_UNSURE
232 # if set, then the various spamchecks are unsure about spaminess of the mail.
233 # The value can hold additional information.
234 SPAM_UNSURE
235
236 # SPAM_UNKNOWN
237 # if set, the spamchecks were skipped. The value gives the reason for
238 # skipping.
239 SPAM_UNKNOWN
240
241 # RETRAIN
242 # if set, causes spamfilters to be retrained, according to the variable's value
243 RETRAIN
244
245 # JUSTME
246 # if set, contains reason why justme message was passed
247 JUSTME
248
249 # DISABLE_DELAYS
250 # if set, disables delaying messages
251 DISABLE_DELAYS
252
253 :0
254 * ? test -e $HOME/procmail.nodelays
255 { DISABLE_DELAYS=true }
256
257 # TZ
258 # used to alter the timezone for delay calculations
259 #TZ=Pacific/Auckland
260
261 # DELAY
262 # argument to /bin/date -d to indicate a message delay. This is overridden by
263 # RELEASE
264 DELAY
265
266 # RELEASE
267 # /bin/date time expression indicating the time at which a message is to be
268 # released. Overrides DELAY.
269 RELEASE
270
271 # MARK_READ
272 # when set, causes mails to be marked as read when delivered. Can be
273 # initialised with DELIVER_READ
274 MARK_READ=$DELIVER_READ
275
276 # vim:ft=procmail