]> git.phdru.name Git - dotfiles.git/blob - .procmailrc
.procmailrc: slightly reorder headers
[dotfiles.git] / .procmailrc
1 #
2 # User configuration file for procmail
3 #
4
5 #
6 # SET VARIABLES
7
8 # Internal Variables
9
10 SHELL=/bin/sh               #Shell used to run procmail.  Be sure this points to
11                             #your system's copy of sh.  DO NOT substitute a
12                             #different shell unless you really know Unix
13
14 LINEBUF=4096                #Needed to keep Procmail from choking on long
15                             #"recipes", or instructions on what to do with
16                             #particular kinds of email.
17
18 PATH=$HOME/bin:$HOME/mail/bin:/bin:/usr/bin:/usr/local/bin
19                             #Path for your programs -- this is probably best
20                             #left alone.
21
22 VERBOSE=off                 #Change this to "on" when you try a new recipe
23                             #so that Procmail will log literally every step
24                             #it takes.  DO NOT LEAVE IT ON, though, because
25                             #it creates huge logfiles.
26
27 # Default Program & file locations
28
29 MAILDIR=${HOME}/Mail        #you'd better make sure this directory exists
30
31 #ORGMAIL=/var/spool/mail/phd
32 #DEFAULT=${ORGMAIL}
33
34 LOGFILE=${MAILDIR}/procmail.log      #Logs message disposition.  Recommended -- otherwise
35                                      #errors are emailed to you. :/
36
37 SENDMAIL=/usr/sbin/sendmail    #useful for autoreply recipes.
38 FORMAIL=/usr/bin/formail       #useful for autoreply recipes.
39
40
41 MYEMAIL=${HOME}/mail/misc/.myemail   #Tells Procmail where your MYEMAIL
42                                      #file is located, a text file containing all the
43                                      #email addresses you use.
44
45 ADMINFOLDER=${MAILDIR}/admin         #for bounced mail, mail from root,
46                                      #postmaster, abuse, etc.
47
48 BLOCKFOLDER=${MAILDIR}/block         #for suspicious mail, but possibly not spam
49
50 BULKFOLDER=${MAILDIR}/bulk           #for bulk mail which appears legitimate, such
51                                      #as mail from mailing lists or mail sent using
52                                      #Bcc:
53
54 SPAMFOLDER=${MAILDIR}/spam           #change this to SPAMFOLDER=/dev/null
55                                      #to delete spam entirely.
56
57 VIRUSFOLDER=/dev/null                #Set this variable to /dev/null to delete
58                                      #all viruses. You don't want to take chances with a virus,
59                                      #and the false positive rate on the virus filters is near zero.
60
61 # BEGIN RECIPES
62
63
64 # Create a backup cache of 2000 most recent messages in case of mistakes
65 :0 c
66 backup
67
68   :0 ic
69   | cd backup && rm -f dummy `ls -t msg.* | sed -e 1,2000d`
70
71 # Regenerate "From" lines to make sure they are valid
72 :0 fhw
73 | ${FORMAIL} -I "From " -a "From "
74
75
76 # *CLOSED (only subscribers can write)* MAILING LISTS
77 # No need to filter them for spam
78
79 :0
80 * ^(From|To|Cc|Reply-To): .*((mlug@unixcenter\.ru)|@altlinux\.ru)
81 lists/mlug
82
83 :0
84 * ^List-Id: Moscow Linux User Group <mlug\.UnixCenter\.RU>
85 lists/mlug
86
87 :0
88 * ^(To|Cc|Reply-To|Resent-To|X-BeenThere): .*(-list@(python\.org|cwi\.nl))
89 lists/python
90
91 :0
92 * ^Sender: python-list-admin@python\.org
93 lists/python
94
95 :0
96 * ^Newsgroups: .*comp\.lang\.python
97 lists/python
98
99 :0
100 * ^List-Id: Python core developers <python-dev\.python\.org>
101 lists/python
102
103 :0
104 * ^List-Id: "Python 3000 process, design, development" <python-3000\.python\.org>
105 lists/python
106
107 :0
108 * ^List-Id: Discussions of speculative Python language ideas.*<python-ideas\.python\.org>
109 lists/python
110
111 :0
112 * ^Sender: "Email-SIG" <email-sig-bounces\+phd=phdru\.name@python\.org>
113 lists/python
114
115 :0
116 * ^Sender: mimelib-devel-admin@lists\.sourceforge\.net
117 lists/python
118
119 :0
120 * ^List-Id: Discussion of the Quixote Web development framework.*<quixote-users\.mems-exchange\.org>
121 lists/python
122
123 :0
124 * ^List-Id: Discussion of the Durus object database.*<durus-users\.mems-exchange\.org>
125 lists/python
126
127 :0
128 * ^From: sitelist-bounces@lists\.sourceforge\.net
129 * ^To: sqlobject-discuss-owner@lists\.sourceforge\.net
130 * ^Subject: Uncaught bounce notification
131 ${SPAMFOLDER}
132
133 :0
134 * ^From: sqlobject-cvs-bounces@lists\.sourceforge\.net
135 * ^To: sqlobject-cvs-owner@lists\.sourceforge\.net
136 * ^Subject: Auto-discard notification
137 ${SPAMFOLDER}
138
139 :0
140 * ^List-Id: .+<sqlobject-(discuss|cvs)\.lists\.sourceforge\.net>
141 lists/python
142
143 :0
144 * ^To: "(\[sqlobject:(bugs|patches)\] )|(Ticket [0-9]+)" <[0-9]+@(bugs|patches)\.sqlobject\.p\.re\.sf\.net>
145 * ^Reply-To: "?(\\?\[sqlobject:(bugs|patches)\\?\] )|(Ticket [0-9]+)"? <[0-9]+@(bugs|patches)\.sqlobject\.p\.re\.sf\.net>
146 * ^Subject: (\[SQL-CVS\] )?\[sqlobject:(bugs|patches)\] (Re: )?\#[0-9]+
147 lists/python
148
149 :0
150 * ^From: "Repository SQLObject (fullhistory|sqlobject|scripts)\.git" .*<noreply@(fullhistory|sqlobject|scripts)\.sqlobject\.p\.re\.sf\.net>
151 * ^To: "Repository SQLObject (fullhistory|sqlobject|scripts)\.git" .*<noreply@(fullhistory|sqlobject|scripts)\.sqlobject\.p\.re\.sf\.net>
152 * ^Reply-To: "Repository SQLObject (fullhistory|sqlobject|scripts)\.git" .*<noreply@(fullhistory|sqlobject|scripts)\.sqlobject\.p\.re\.sf\.net>
153 * ^Subject: \[sqlobject:(fullhistory|sqlobject|scripts)\]
154 lists/python
155
156 :0
157 * ^From: .+<notifications@github\.com>
158 * ^To: sqlobject/sqlobject <sqlobject@noreply\.github\.com>
159 * ^List-ID: sqlobject/sqlobject <sqlobject\.sqlobject\.github\.com>
160 lists/python
161
162 :0
163 * ^Sender: ppa-qps-devel-admin@lists\.sourceforge\.net
164 lists/python
165
166 :0
167 * ^Sender: pysqlite-bounces@lists\.initd\.org
168 lists/python
169
170 :0
171 * ^List-Id: <parsedatetime-dev\.googlegroups\.com>
172 lists/python
173
174 :0
175 * ^(To|Cc|Reply-To|Resent-To|Sender): .*(zope.*@zope\.(org|net|com))|(zip@eevolute\.com)
176 lists/zope
177
178
179 # Now filters
180
181 # Klez
182 :0 B
183 * ^Content-Transfer-Encoding: base64
184 * name( ?)=.*\.(com|exe|bat|scr|pif)
185 | ${FORMAIL} -A"X-Note: Klez" -A"X-Folder: Virus" >${VIRUSFOLDER}
186
187 # Sobig.E
188 :0 HB
189 * ^Subject: Re: (Movie|Application)$
190 * ^Content-Transfer-Encoding: base64
191 * ^Content-Disposition: attachment;
192 * filename=.your_details\.zip
193 | ${FORMAIL} -A"X-Note: Sobig.E" -A"X-Folder: Virus" >${VIRUSFOLDER}
194
195 # Sobig.F
196 :0 H
197 * ^Subject: .*(Thank you!|Your application|That movie|Approved|Details|My details|Your details|Wicked screensaver)$
198 * ^X-MailScanner: Found to be clean$
199 | ${FORMAIL} -A"X-Note: Sobig.F" -A"X-Folder: Virus" >${VIRUSFOLDER}
200
201 # MyDoom/Novarg
202 :0 HB
203 * <50000
204 * ^Subject: (test|hi|hello|Mail Delivery System|Mail Transaction Failed|Server Report|Status|Error|)$
205 * ^Content-type: application/octet-stream;
206 * (file)?name="(document|readme|doc|text|file|data|test|message|body)\.(pif|scr|exe|cmd|bat|zip)
207 | ${FORMAIL} -A"X-Note: MyDoom" -A"X-Folder: Virus" >${VIRUSFOLDER}
208
209 # Netsky
210 :0
211 * > 20000
212 * < 60000
213 * ^Subject:[ ]*(hi|hello|read it immediately|\
214 something for you|warning|information|stolen|fake|unknown)
215 * B ?? ^(anything ok\?|what does it mean?|ok|\
216 i'm waiting|read the details\.|here is the document\.|\
217 read it immediately\!|my hero|\
218 here|is that true?|is that your name?|is that your account?|\
219 i wait for a reply\!|is that from you?|you are a bad writer|\
220 I have your password\!|something about you\!|\
221 kill the writer of this document\!|i hope it is not true\!|\
222 your name is wrong|i found this document about you|\
223 yes, really\?|that is bad|here it is|see you|\
224 greetings|stuff about you\?|something is going wrong!|\
225 information about you|about me|from the chatter|\
226 here, the serials|here, the introduction|here, the cheats|\
227 that's funny|do you\?|reply|take it easy|why\?|\
228 thats wrong|misc|you earn money|you feel the same|\
229 you try to steal|you are bad|something is going wrong|\
230 something is fool)$
231 * B ?? ^(Content-Disposition:[  ]*attachment;)?[        ]*(file)?name="?(document|msg|doc|talk|message|creditcard|\
232 details|attachment|me|stuff|posting|textfile|concert|\
233 information|note|bill|swimmingpool|product|\
234 topseller|ps|shower|aboutyou|nomoney| found|\
235 story|mails|website|friend|jokes|location|\
236 final|release|dinner|ranking|object|mail2|part2|\
237 disco|party|misc)\..*(zip|exe|scr|com|pif)"?$
238 | ${FORMAIL} -A"X-Note: Netsky" -A"X-Folder: Virus" >${VIRUSFOLDER}
239
240 # Bagle.J
241 :0
242 * ^Subject:(.*E-mail account disabling warning)|\
243    (.*E-mail account security warning)|\
244    (.*Email account utilization warning)|\
245    (.*Important notify about your e-mail account)|\
246    (.*Notify about using the e-mail account)|\
247    (.*Notify about your e-mail account utilization)|\
248    (.*Warning about your e-mail account)
249 * B ?? ^Content-Type: application/octet-stream;
250 * B ?? ^Content-Transfer-Encoding: base64
251 * B ?? ^Content-Disposition: attachment;
252 | ${FORMAIL} -A"X-Note: Bagle.J" -A"X-Folder: Virus" >${VIRUSFOLDER}
253
254
255 # From http://www.internetguru.com.au/igblog-102.html
256
257 # Redirect common virus attachments inc. zipped versions
258 :0 B
259 * name=.*(document|readme|doc|text|file|data|test|message|body)\.(vbs\"|wsf\"|vbe\"|wsh\"|hta\"|scr\"|pif\"|exe\"|shs\"|bat\"|bas\"|cmd\"|zip\")
260 {
261    :0
262    | ${FORMAIL} -A"X-Note: executable attachment virus" -A"X-Folder: Virus" >>${VIRUSFOLDER}
263 }
264
265 # Some more common virus attachments inc. zipped versions
266 :0 B
267 * name=.*(Attach|Information|Readme|Document|Info|TextDocument|Textfile|MoreInfo|Message)\.(pif\"|zip\")
268 {
269    :0
270    | ${FORMAIL} -A"X-Note: executable attachment virus" -A"X-Folder: Virus" >>${VIRUSFOLDER}
271 }
272
273 # Redirect windows executables (note - haven't included exe and com
274 :0 B
275 * name=.*\.(vbs\"|wsf\"|vbe\"|wsh\"|hta\"|scr\"|pif\"|shs\"|bat\"|bas\"|scr\"|dll\")
276 {
277    :0
278    | ${FORMAIL} -A"X-Note: executable attachment virus" -A"X-Folder: Virus" >>${VIRUSFOLDER}
279 }
280
281 # This one finds them annoying Custom Logo spams that seem to get past most filters
282 :0 B
283 * .*out\.php\?email\=(sales|info)\@
284 {
285    :0
286    | ${FORMAIL} -A"X-Note: Custom Logo spam" -A"X-Folder: Spam" >>${SPAMFOLDER}
287 }
288
289 # This catches about 99% of deliberate viagra mispellings ie v1@GRa, v1agr@ etc
290 :0 H
291 * ^Subject.*[Vv][1jl\|][aA\@][Gg][Rr][Aa\@]
292 {
293    :0
294    | ${FORMAIL} -A"X-Note: viagra spam" -A"X-Folder: Spam" >/dev/null
295 }
296
297
298 # Chineese/japaneese/korean spam
299
300 :0
301 * ^Content-Type: text/(plain|html); *charset=("?)(big5|gb2312|iso-2022-jp|ks_c_5601-1987|shift_jis)("?)
302 | ${FORMAIL} -A"X-Note: chineese/japaneese/korean charset" -A"X-Folder: Spam" >/dev/null
303
304 :0
305 * ^X-RBL-Warning: .*(china|korea) does not seem to care about spam
306 | ${FORMAIL} -A"X-Note: chineese/korean source" -A"X-Folder: Spam" >>${SPAMFOLDER}
307
308
309 # SpamAssassin (spamassassin.org)
310 :0fw
311 * < 10240000
312 | spamc -U /tmp/spamassassin.sock -s 10240000
313
314
315 # Mail with a score of 14 or higher is certainly spam
316 :0:
317 * ^X-Spam-Level: \*\*\*\*\*\*\*\*\*\*\*\*\*\*
318 | ${FORMAIL} -A"X-Note: certainly spam" -A"X-Folder: Spam" >/dev/null
319
320 :0:
321 * ^X-Spam-Status: Yes
322 * > 20000
323 | ${FORMAIL} -A"X-Note: oversized spam" -A"X-Folder: Spam" >/dev/null
324
325 :0 HB:
326 * ^X-Spam-Status: Yes
327 * http://www\.gstinc\.com/
328 | ${FORMAIL} -A"X-Note: gstinc spam" -A"X-Folder: Spam" >/dev/null
329
330 :0 HB:
331 * ^X-Spam-Status: Yes
332 * (www\.)?sonidom\.ru
333 | ${FORMAIL} -A"X-Note: sonidom spam" -A"X-Folder: Spam" >/dev/null
334
335 :0 HB:
336 * ^X-Spam-Status: Yes
337 * (www\.)?pos-tel\.ru
338 | ${FORMAIL} -A"X-Note: pos-tel spam" -A"X-Folder: Spam" >/dev/null
339
340 :0 HB:
341 * ^X-Spam-Status: Yes
342 * @besttraining\.ru
343 | ${FORMAIL} -A"X-Note: besttraining spam" -A"X-Folder: Spam" >/dev/null
344
345 # HTML-only mail is almost certainly spam
346 #:0
347 #* ^Content-Type: text/html
348 #| ${FORMAIL} -A"X-Note: HTML-only mail" -A"X-Folder: Spam" >/dev/null
349
350 :0:
351 * ^X-Spam-Status: Yes
352 ${SPAMFOLDER}
353
354
355 # MAILING LISTS
356
357 # Filter out mail from all mailing lists you are on. Just duplicate the recipe
358 # for each mailing list you are on, and put the correct address for the list in
359 # the condition statement. (The "* ^TO" part.) If you read mail on shell, you
360 # may find it easier to deliver this mail to separate folders, especially for
361 # busy lists. I do. :)
362
363
364 # Block all messages that are too big
365 :0
366 * > 1000000
367 | ${FORMAIL} -A"X-Note: the message is too big" -A"X-Folder: Block" >>${BLOCKFOLDER}
368
369
370 # unfiltered mail marked by exim (using RBL/ORBS/etc)
371
372 :0
373 * ^X-RBL-Warning:
374 * ^(To|Cc):.*phd
375 ${BLOCKFOLDER}
376
377 :0
378 * ^X-RBL-Warning:
379 ${SPAMFOLDER}
380
381
382 # Sort out mail that really is to you from mail Bcc'd to you, or mail
383 # which doesn't have any of your email addresses on the To: or Cc: line.
384 # For this to work properly, you must create a text file named .myemail
385 # in your home directory and enter all email addresses that belong to
386 # you in it, one per line, just as you do with your .nobounce file.
387 #
388 # This does =wonders= in keeping spam from appearing in your personal
389 # mail. :)
390 #
391 # Substitute your shell account email address, custom domain, and any other email
392 # address you may have for the entries below.
393 :0:
394 * ? test -f ${MYEMAIL} && \
395     (${FORMAIL} -zxTo: -zxCc: |\
396     fgrep -i -f ${MYEMAIL})
397 | ${FORMAIL} -A"X-Folder: Default" >>${DEFAULT}
398
399 # Deliver email which passed spam filtering, but which wasn't sent to
400 # a recognizable personal email address of yours, to your "bulk mail"
401 # folder, for reading on a less-urgent basis.
402 :0:
403 | ${FORMAIL} -A"X-Folder: Bulk" >>${BULKFOLDER}
404
405
406 # Vacation - modified version of procmail example from "man procmailex"
407
408 # Drop duplicates
409 #:0 Wh: msgid.lock
410 #| ${FORMAIL} -D 65536 msgid.cache
411 #
412 #:0 Whc: vacation.lock
413 #* !^From: .*phd
414 #* !^FROM_MAILER
415 #* !^FROM_DAEMON
416 #* !^X-Loop: phd@phdru.name
417 #* !^X-Loop: phd@iskra.aviel.ru
418 #* !^From: "AviTicket" <support@aviel\.ru>
419 #* !^From: .* <lj_notify@livejournal\.com>
420 #* !^From: .*report_card@sbrf.ru
421 #| ${FORMAIL} -rD 65536 vacation.cache
422 #
423 #:0 ehc  # if the name was not in the cache - reply
424 #| (egrep -v '^From phd|^Return-Path: phd' | \
425 #   ${FORMAIL} -r -A"Precedence: junk" \
426 #      -A"X-Loop: phd@phdru.name" -A"X-Loop: phd@iskra.aviel.ru" \
427 #      -A"Content-Type: text/plain; charset=koi8-r"; \
428 #   echo "Hello!"; echo "";\
429 #   echo "   I am on vacation. This is an auto-generated reply. Your message has been"; \
430 #   echo "delivered to my mailbox. Thanks a lot. I will read it after 0th of ."; \
431 #   echo ""; \
432 #   echo "Здравствуйте."; echo ""; \
433 #   echo "   Я уехал в отпуск. Это автоматический ответ. Ваше сообщение было доставлено."; \
434 #   echo "в мой почтовый ящик. Большое спасибо. Я прочту его, когда вернусь 0 ."; \
435 #   echo ""; cat $HOME/.signature) | $SENDMAIL -oi -t