]> git.donarmstrong.com Git - remote_mail.git/blob - .procmailrc
add remote mail and procmailrc
[remote_mail.git] / .procmailrc
1 PATH=/bin:/usr/bin:/usr/X11R6/bin:/sbin:/usr/sbin:/usr/local/bin:/usr/X11R6/bin
2
3 SHELL=/bin/bash
4
5 # "VERBOSE=on" is only used for debugging.
6 VERBOSE=off
7
8 SENDMAIL=sendmail
9 MAILDIR=$HOME/Maildir
10 DEFAULT=$MAILDIR/Inbox/
11 LOGFILE=$HOME/.procmail_log
12 # LOGABSTRACT = "all"
13
14 # TODO
15
16 :0 c:
17 $HOME/Mail/temp/
18
19 # Add filter for "your message to foo awaits moderator approval"
20 # filter out owner mails
21
22
23 # where to send spam
24 HIGHSPAM=spam/HIGHSPAM/
25 SPAM=spam/SPAM/
26
27 # A list (one per line) of people I KNOW are spammers :-)
28 # can match any part of name so you can use fred, fred@aol.com or aol.com to
29 # match a user, mail address or domain.
30 # Note that this file is case-insensitive.
31 SPAMMERS=$HOME/.procmail/spammers
32
33 # name of the file containing a list of people we
34 # always want to get mail from, one per line.  If
35 # any substring of the From: or Sender: line matches
36 # a line of this file, it will go through, so this
37 # can be used to denote entire sites that we always
38 # wish to get mail from as well as individuals.
39 # E.g. "user", "user@aol.com" or "aol.com".
40 # Note that this file is case-insensitive.
41 # Putting all of the people or lists you get lots
42 # of mail from here will not only insure you get
43 # it, but will speed up procmail.
44 FRIENDS=$HOME/.procmail/friends
45
46 # ======================================
47 # Preventing duplicates using 16Kb cache
48 # They get shoved in duplicates folder
49 #:0 Whc: .msgid.lock
50 #| formail -D 16384 msgid.cache.new
51 #:0 a:
52 #/dev/null
53
54 :0 H
55 * ^Subject:.*Rnm-devel moderator request
56 /dev/null
57
58 :0 H
59 * ^Subject:.*Cron.*debbugs@master
60 /dev/null
61
62
63 :0 Hc
64 * !Message-Id: .*delay[0-9]+@
65 * ^TO \/don\+de[^@]+
66 $HOME/Mail/delay
67
68 :0 Hhbw
69 * !Message-Id: .*delay[0-9]+@
70 * ^TO \/don\+delay\+[^@]+
71 |/home/don/bin/delay_mail --mailto don@donarmstrong.com --enqueue --email --delay $MATCH
72
73
74 # ==========================================================================
75 # Correct crap or broken mails using sed
76 # ==========================================================================
77 # Correct wrong sig-dashes, ie add a space for lines with only "--" in them:
78 # from: ^--$
79 # to:   ^-- $
80 #:0 fBw
81 #* ^--$
82 #| sed -e 's/^--$/-- /'
83
84 # preconverts all plain-text mail arriving in certain encoded
85 # MIME formats into a more compact 8-bit format which can be
86 # used and displayed more easily by most programs.
87 #:0
88 #* ^Content-Type: *text/plain
89 #{
90 #:0 fbw
91 #* ^Content-Transfer-Encoding: *quoted-printable
92 #| mimencode -u -q
93
94 #:0 Afhw
95 #| formail -I "Content-Transfer-Encoding: 8bit"
96
97 #:0 fbw
98 #* ^Content-Transfer-Encoding: *base64
99 #| mimencode -u -b
100
101 #:0 Afhw
102 #| formail -I "Content-Transfer-Encoding: 8bit"
103 #}
104
105 # Convert old-style PGP messages to MIME
106 :0
107 * !^Content-Type: multipart/
108 * !^Content-Type: application/pgp
109 {
110     :0 fBw
111     * ^-----BEGIN PGP MESSAGE-----
112     * ^-----END PGP MESSAGE-----
113     | formail \
114         -i "Content-Type: application/pgp; format=text; x-action=encrypt"
115
116     :0 fBw
117     * ^-----BEGIN PGP SIGNED MESSAGE-----
118     * ^-----BEGIN PGP SIGNATURE-----
119     * ^-----END PGP SIGNATURE-----
120     | formail \
121         -i "Content-Type: application/pgp; format=text; x-action=sign"
122 }
123
124 ######################################################################
125 # Here we search the list of people we always want to get mail from, #
126 # and deliver the mail if it's from one of them, no matter what.     #
127 # The FRIENDS file is set and described above.                       #
128 ######################################################################
129 :0:
130 * ! ? (formail -x From: -x Sender: | fgrep -iqf $FRIENDS)
131 {
132
133 # $DEFAULT
134 # deliver to default mailbox
135
136 #spamassasin is being run sitewide.
137
138 # Mails with a score of 15 or higher are almost certainly spam (with 0.05%
139 # false positives according to rules/STATISTICS.txt). Let's put them in a
140 # different mbox. (This one is optional.)
141 :0:
142 * ^X-Spam-Level: \*\*\*\*\*\*\*\*\*\*\*\*\*\*\*
143 #definetly_spam
144 /dev/null
145
146 # Mails that are clearly spam, but we don't want to toss immediately
147 :0:
148 * ^X-Spam-Level: \*\*\*\*\*\*\*\*
149 $HIGHSPAM
150
151 # All mail tagged as spam (eg. with a score higher than the set threshold)
152 # is moved to "probably-spam".
153 :0:
154 * ^X-Spam-Status: Yes
155 $SPAM
156
157
158
159 # Work around procmail bug: any output on stderr will cause the "F" in "From"
160 # to be dropped.  This will re-add it.
161 :0 H
162 * ! ^From[ ]
163 * ^rom[ ]
164 {
165   LOG="*** Dropped F off From_ header! Fixing up. "
166
167   :0 fhw
168   | sed -e 's/^rom /From /'
169 }
170
171
172
173
174 ##################################################################
175 #         SPAM filter. I don't like spam. I just don't           #
176 ##################################################################
177
178 # Here we search a file with a list of people we _never_ want to
179 # get anything from, tossing the mail if it's from one of them.
180 # SPAMMERS is set and described above.
181 # Note, you can use the following line instead to be even more
182 # strict, they can't have even relayed it via an adress in the
183 # spammers file:
184 # * ? (formail -x From: -x Sender: -x Reply-To: -x Received: | fgrep -iqf $SPAMMERS)
185 :0:
186 * ? (formail -x From: -x Sender: -x Reply-To: | fgrep -iqf $SPAMMERS)
187 | formail -A "X-SPAM-RULE: address found in spammers file" >> $SPAM
188
189 # look for X-Advertisement header or 'advertisement' in the subject,
190 # accounting for possible sp. error.  "Nice" spammers use this header.
191 :0:
192 * ^X-Adverti[sz]ement:
193 | formail -A "X-SPAM-RULE: X-Advertisement header" >> $SPAM
194
195 :0:
196 * ^Subject:.*adverti[sz]ement
197 | formail -A "X-SPAM-RULE: Advertisement in subject" >> $SPAM
198
199 # snag the To: and From: headers
200 TO=`formail -zx To:`
201 CC=`formail -zx Cc:`
202 FROM=`formail -zX From: | formail -zrx To:`
203
204 # no To: line AND no Cc: line. You could filter out anything with no To:,
205 # but there are lots of mailinglist idiots who Cc the list and don't To:
206 # anyone ;-)
207 :0:
208 * TO??^$
209 * CC??^$
210 | formail -A "X-SPAM-RULE: no To: or Cc: header" >> $SPAM
211
212 # bogus pegasus header, very common with spammers, and I've never
213 # seen it used by anyone else.
214 :0:
215 * ^Comment: Authenticated sender is
216 * ! ^X-Mailer: Pegasus
217 | formail -A "X-SPAM-RULE: bogus pegasus header" >> $SPAM
218
219 #large number of spaces then number in subject
220 :0:
221 * ^Subject:.*\ \ \ \ \ \ \ \ \ [0-9][0-9]+
222 | formail -A "X-SPAM-RULE: too many spaces followed by number in subject" >> $SPAM
223
224 #laser toner cartridges. (I mean, come, on!)
225 :0:
226 * ^Subject: laser cartridges
227 | formail -A "X-SPAM-RULE: laser cartridges suck" >> $SPAM
228
229 }
230
231 # Debian role accounts
232
233 :0:
234 * ^Delivered-To: (owner@bugs.debian.org)
235 bugs.debian.org/
236
237 :0:
238 * ^Delivered-To: (listmaster@lists.debian.org)
239 lists.debian.org/
240
241
242 # OFTC stuff
243 :0:
244 * ^TO (oftc@spi-inc.org)
245 oftc/
246
247 # Chili ALRM
248 :0:
249 * ^Subject:\ (\[comment\])?\[ALRM\ \#
250 chili_alarm/
251
252 :0:
253 * ^From:\ nagios@nagios-global.lab.propel.com
254 chili_alarm/
255
256 #
257 :0:
258 * ^From:\ noreply@dragongoserver.net
259 lists/dragongo/
260
261 ###################
262 #  Mailing lists  #
263 5B5B###################
264
265 :0:
266 * X-Mailing-List: <\/[^@]+
267 lists/`echo $MATCH | sed -e 's/[\/]/_/g'`/
268
269 :0:
270 * ^Delivered-To: mailing list \/[^@]+
271 lists/`echo $MATCH | sed -e 's/[\/]/_/g'`/
272
273 :0:
274 * ^Sender: owner-\/[^@]+
275 lists/`echo $MATCH | sed -e 's/[\/]/_/g'`/
276
277 :0:
278 * ^Sender: \/[^@]+-bounces?
279 lists/`echo $MATCH | sed -e 's/\-bounces*//g; s/[\/]/_/g'`/
280
281 :0:   
282 * ^X-BeenThere: \/[^@]+
283 lists/`echo $MATCH | sed -e 's/[\/]/_/g'`/
284
285
286 # Dumb apache mailing lists
287 :0:
288 * ^List-Post: <mailto:\/[^@]+
289 lists/`echo $MATCH | sed -e 's/[\/]/_/g'`/
290
291
292 # Debian's bug system uses X-Loop
293 8
294 :0:
295 * ^X-PTS-Package: \/.+
296 bugs/`echo $MATCH |sed -e 's/[\/]/_/g'`/
297
298 :0:
299 * ^X-Debian-PR-Package: \/.+
300 bugs/`echo $MATCH |sed -e 's/[\/]/_/g'`/
301
302 :0:
303 * ^X-Loop: owner@bugs.debian.org
304 bugs/control_messages/
305
306 :0:
307 * X-Loop: \/[^@]+
308 lists/`echo $MATCH | sed -e 's/[\/]/_/g'`/
309
310 :0:
311 * X-ML-Name: \/[^@]+
312 lists/`echo $MATCH | sed -e 's/[\/]/_/g'`/
313
314 # damn kernel back-to-frontness
315 :0:
316 * ^Sender:[      ]linux-kernel-owner@vger.kernel.org
317 lists/linux-kernel/
318
319 # linux-scsi
320 :0:
321 * ^Sender:[      ]linux-scsi-owner@vger.kernel.org
322 lists/linux-scsi/
323
324 # emacs-pretesters
325 :0:
326 * ^Sender:[      ]emacs-pretesters@gnu.org
327 lists/emacs-pretesters/
328
329 :0:
330 * ^Sender:.*GENE-ARRAYS@ITSSRV1.UCSF.EDU
331 lists/gene-arrays/
332
333 :0:
334 * ^Sender:.*scd-bounce@blars.org
335 lists/scd/
336
337 # broken lists using win32 software and NO LIST HEADER. Dumb.
338 :0:
339 * ^Sender: (Bugtraq|Incidents Mailing|VULN-DEV) List
340 lists/bugtraq/
341
342 #########################################
343 # Final SPAM filter, post mailing lists #
344 #########################################
345
346 # NOTE: This catches like 80% of my SPAM, it really works but make the match
347 # CORRECT :-)
348
349 # Not mailing list, but not to me. SPAM.
350 #:0:
351 #* !^TO(anylevel.com|donarmstrong.com|donarmstrong.org|oneinfinity.com|donarmstrong.net|pellam.ucr.edu|rzlab.ucr.edu|student.ucr.edu|localhost|Blind\.Copy\.Receiver)
352 #| formail -A "X-SPAM-RULE: Not to one of my addresses or a mailing list" >> $SPAM
353
354
355 #####################################
356 # Last rule:  Put mail into mailbox #
357 #####################################
358
359 :0:
360 $DEFAULT
361
362 # End of file