]> git.phdru.name Git - dotfiles.git/blob - .procmailrc
Feat: On exit from `vim` do `cd` to its last working directory
[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\.org
93 lists/python
94
95 :0
96 * ^List-Id: .*<(python-.*|core-workflow)\.python\.org>
97 lists/python
98
99 :0
100 * ^Newsgroups: .*comp\.lang\.python
101 lists/python
102
103 :0
104 * ^From: sitelist-bounces@lists\.sourceforge\.net
105 * ^To: .*-owner@lists\.sourceforge\.net
106 * ^Subject: Uncaught bounce notification
107 ${SPAMFOLDER}
108
109 :0
110 * ^From: .*-bounces@lists\.sourceforge\.net
111 * ^To: .*-owner@lists\.sourceforge\.net
112 * ^Subject: Auto-discard notification
113 ${SPAMFOLDER}
114
115 :0
116 * ^List-Id: .+<sqlobject-(discuss|cvs)\.lists\.sourceforge\.net>
117 lists/python
118
119 :0
120 * ^To: "(\[sqlobject:(bugs|patches)\] )|(Ticket [0-9]+)" <[0-9]+@(bugs|patches)\.sqlobject\.p\.re\.sf\.net>
121 * ^Reply-To: "?(\\?\[sqlobject:(bugs|patches)\\?\] )|(Ticket [0-9]+)"? <[0-9]+@(bugs|patches)\.sqlobject\.p\.re\.sf\.net>
122 * ^Subject: (\[SQL-CVS\] )?\[sqlobject:(bugs|patches)\] (Re: )?\#[0-9]+
123 lists/python
124
125 :0
126 * ^From: "SQLObject Git repository" <noreply@(fullhistory|sqlobject|scripts)\.sqlobject\.p\.re\.sf\.net>
127 * ^To: "SQLObject Git repository" <noreply@(fullhistory|sqlobject|scripts)\.sqlobject\.p\.re\.sf\.net>
128 * ^Reply-To: "SQLObject Git repository" <noreply@(fullhistory|sqlobject|scripts)\.sqlobject\.p\.re\.sf\.net>
129 * ^Subject: \[sqlobject:(fullhistory|sqlobject|scripts)\]
130 lists/python
131
132 :0
133 * ^From: .+<notifications@github\.com>
134 * ^To: sqlobject/sqlobject <sqlobject@noreply\.github\.com>
135 * ^List-ID: sqlobject/sqlobject <sqlobject\.sqlobject\.github\.com>
136 lists/python
137
138 :0
139 * ^List-Id: .*<cheetahtemplate-(announce|discuss)\.lists\.sourceforge\.net>
140 lists/python
141
142 :0
143 * ^From: .+<notifications@github\.com>
144 * ^To: CheetahTemplate3/cheetah3 <cheetah3@noreply\.github\.com>
145 * ^List-ID: CheetahTemplate3/cheetah3 <cheetah3\.CheetahTemplate3\.github\.com>
146 lists/python
147
148 :0
149 * ^Sender: ppa-qps-devel-admin@lists\.sourceforge\.net
150 lists/python
151
152 :0
153 * ^List-Id: PyGreSQL Development <pygresql\.vex\.net>
154 lists/python
155
156 :0
157 * ^List-Id: eGenix\.com User Mailinglist <egenix-users\.egenix\.com>
158 lists/python
159
160 :0
161 * ^List-Id: "generateDS\.py users discussion list".*<generateds-users\.lists\.sourceforge\.net>
162 lists/python
163
164
165 # Now filters
166
167 # Klez
168 :0 B
169 * ^Content-Transfer-Encoding: base64
170 * name( ?)=.*\.(exe|bat|scr|pif)
171 | ${FORMAIL} -A"X-Note: Klez" -A"X-Folder: Virus" >${VIRUSFOLDER}
172
173 # Sobig.E
174 :0 HB
175 * ^Subject: Re: (Movie|Application)$
176 * ^Content-Transfer-Encoding: base64
177 * ^Content-Disposition: attachment;
178 * filename=.your_details\.zip
179 | ${FORMAIL} -A"X-Note: Sobig.E" -A"X-Folder: Virus" >${VIRUSFOLDER}
180
181 # Sobig.F
182 :0 H
183 * ^Subject: .*(Thank you!|Your application|That movie|Approved|Details|My details|Your details|Wicked screensaver)$
184 * ^X-MailScanner: Found to be clean$
185 | ${FORMAIL} -A"X-Note: Sobig.F" -A"X-Folder: Virus" >${VIRUSFOLDER}
186
187 # MyDoom/Novarg
188 :0 HB
189 * <50000
190 * ^Subject: (test|hi|hello|Mail Delivery System|Mail Transaction Failed|Server Report|Status|Error|)$
191 * ^Content-type: application/octet-stream;
192 * (file)?name="(document|readme|doc|text|file|data|test|message|body)\.(pif|scr|exe|cmd|bat|zip)
193 | ${FORMAIL} -A"X-Note: MyDoom" -A"X-Folder: Virus" >${VIRUSFOLDER}
194
195 # Netsky
196 :0
197 * > 20000
198 * < 60000
199 * ^Subject:[ ]*(hi|hello|read it immediately|\
200 something for you|warning|information|stolen|fake|unknown)
201 * B ?? ^(anything ok\?|what does it mean?|ok|\
202 i'm waiting|read the details\.|here is the document\.|\
203 read it immediately\!|my hero|\
204 here|is that true?|is that your name?|is that your account?|\
205 i wait for a reply\!|is that from you?|you are a bad writer|\
206 I have your password\!|something about you\!|\
207 kill the writer of this document\!|i hope it is not true\!|\
208 your name is wrong|i found this document about you|\
209 yes, really\?|that is bad|here it is|see you|\
210 greetings|stuff about you\?|something is going wrong!|\
211 information about you|about me|from the chatter|\
212 here, the serials|here, the introduction|here, the cheats|\
213 that's funny|do you\?|reply|take it easy|why\?|\
214 thats wrong|misc|you earn money|you feel the same|\
215 you try to steal|you are bad|something is going wrong|\
216 something is fool)$
217 * B ?? ^(Content-Disposition:[  ]*attachment;)?[        ]*(file)?name="?(document|msg|doc|talk|message|creditcard|\
218 details|attachment|me|stuff|posting|textfile|concert|\
219 information|note|bill|swimmingpool|product|\
220 topseller|ps|shower|aboutyou|nomoney| found|\
221 story|mails|website|friend|jokes|location|\
222 final|release|dinner|ranking|object|mail2|part2|\
223 disco|party|misc)\..*(zip|exe|scr|com|pif)"?$
224 | ${FORMAIL} -A"X-Note: Netsky" -A"X-Folder: Virus" >${VIRUSFOLDER}
225
226 # Bagle.J
227 :0
228 * ^Subject:(.*E-mail account disabling warning)|\
229    (.*E-mail account security warning)|\
230    (.*Email account utilization warning)|\
231    (.*Important notify about your e-mail account)|\
232    (.*Notify about using the e-mail account)|\
233    (.*Notify about your e-mail account utilization)|\
234    (.*Warning about your e-mail account)
235 * B ?? ^Content-Type: application/octet-stream;
236 * B ?? ^Content-Transfer-Encoding: base64
237 * B ?? ^Content-Disposition: attachment;
238 | ${FORMAIL} -A"X-Note: Bagle.J" -A"X-Folder: Virus" >${VIRUSFOLDER}
239
240
241 # From http://www.internetguru.com.au/igblog-102.html
242
243 # Redirect common virus attachments inc. zipped versions
244 :0 B
245 * name=.*(document|readme|doc|text|file|data|test|message|body)\.(vbs\"|wsf\"|vbe\"|wsh\"|hta\"|scr\"|pif\"|exe\"|shs\"|bat\"|bas\"|cmd\"|zip\")
246 {
247    :0
248    | ${FORMAIL} -A"X-Note: executable attachment virus" -A"X-Folder: Virus" >>${VIRUSFOLDER}
249 }
250
251 # Some more common virus attachments inc. zipped versions
252 :0 B
253 * name=.*(Attach|Information|Readme|Document|Info|TextDocument|Textfile|MoreInfo|Message)\.(pif\"|zip\")
254 {
255    :0
256    | ${FORMAIL} -A"X-Note: executable attachment virus" -A"X-Folder: Virus" >>${VIRUSFOLDER}
257 }
258
259 # Redirect windows executables (note - haven't included exe and com
260 :0 B
261 * name=.*\.(vbs\"|wsf\"|vbe\"|wsh\"|hta\"|scr\"|pif\"|shs\"|bat\"|bas\"|scr\"|dll\")
262 {
263    :0
264    | ${FORMAIL} -A"X-Note: executable attachment virus" -A"X-Folder: Virus" >>${VIRUSFOLDER}
265 }
266
267 # This one finds them annoying Custom Logo spams that seem to get past most filters
268 :0 B
269 * .*out\.php\?email\=(sales|info)\@
270 {
271    :0
272    | ${FORMAIL} -A"X-Note: Custom Logo spam" -A"X-Folder: Spam" >>${SPAMFOLDER}
273 }
274
275 # This catches about 99% of deliberate viagra mispellings ie v1@GRa, v1agr@ etc
276 :0 H
277 * ^Subject.*[Vv][1jl\|][aA\@][Gg][Rr][Aa\@]
278 {
279    :0
280    | ${FORMAIL} -A"X-Note: viagra spam" -A"X-Folder: Spam" >/dev/null
281 }
282
283
284 # Chineese/japaneese/korean spam
285
286 :0
287 * ^Content-Type: text/(plain|html); *charset=("?)(big5|gb2312|iso-2022-jp|ks_c_5601-1987|shift_jis)("?)
288 | ${FORMAIL} -A"X-Note: chineese/japaneese/korean charset" -A"X-Folder: Spam" >/dev/null
289
290 :0
291 * ^X-RBL-Warning: .*(china|korea) does not seem to care about spam
292 | ${FORMAIL} -A"X-Note: chineese/korean source" -A"X-Folder: Spam" >>${SPAMFOLDER}
293
294
295 # SpamAssassin (spamassassin.org)
296 :0fw
297 * < 10240000
298 | spamc -U /tmp/spamassassin.sock -s 10240000
299
300
301 # Mail with a score of 14 or higher is certainly spam
302 :0:
303 * ^X-Spam-Level: \*\*\*\*\*\*\*\*\*\*\*\*\*\*
304 | ${FORMAIL} -A"X-Note: certainly spam" -A"X-Folder: Spam" >/dev/null
305
306 :0:
307 * ^X-Spam-Status: Yes
308 * > 20000
309 | ${FORMAIL} -A"X-Note: oversized spam" -A"X-Folder: Spam" >/dev/null
310
311 :0 HB:
312 * ^X-Spam-Status: Yes
313 * http://www\.gstinc\.com/
314 | ${FORMAIL} -A"X-Note: gstinc spam" -A"X-Folder: Spam" >/dev/null
315
316 :0 HB:
317 * ^X-Spam-Status: Yes
318 * (www\.)?sonidom\.ru
319 | ${FORMAIL} -A"X-Note: sonidom spam" -A"X-Folder: Spam" >/dev/null
320
321 :0 HB:
322 * ^X-Spam-Status: Yes
323 * (www\.)?pos-tel\.ru
324 | ${FORMAIL} -A"X-Note: pos-tel spam" -A"X-Folder: Spam" >/dev/null
325
326 :0 HB:
327 * ^X-Spam-Status: Yes
328 * @besttraining\.ru
329 | ${FORMAIL} -A"X-Note: besttraining spam" -A"X-Folder: Spam" >/dev/null
330
331 :0:
332 * ^X-Spam-Status: Yes
333 ${SPAMFOLDER}
334
335
336 # MAILING LISTS
337
338 # Filter out mail from all mailing lists you are on. Just duplicate the recipe
339 # for each mailing list you are on, and put the correct address for the list in
340 # the condition statement. (The "* ^TO" part.) If you read mail on shell, you
341 # may find it easier to deliver this mail to separate folders, especially for
342 # busy lists. I do. :)
343
344
345 # Block all messages that are too big
346 :0
347 * > 1000000
348 | ${FORMAIL} -A"X-Note: the message is too big" -A"X-Folder: Block" >>${BLOCKFOLDER}
349
350
351 # unfiltered mail marked by exim (using RBL/ORBS/etc)
352
353 :0
354 * ^X-RBL-Warning:
355 * ^(To|Cc):.*phd
356 ${BLOCKFOLDER}
357
358 :0
359 * ^X-RBL-Warning:
360 ${SPAMFOLDER}
361
362
363 # Sort out mail that really is to you from mail Bcc'd to you, or mail
364 # which doesn't have any of your email addresses on the To: or Cc: line.
365 # For this to work properly, you must create a text file named .myemail
366 # in your home directory and enter all email addresses that belong to
367 # you in it, one per line, just as you do with your .nobounce file.
368 #
369 # This does =wonders= in keeping spam from appearing in your personal
370 # mail. :)
371 #
372 # Substitute your shell account email address, custom domain, and any other email
373 # address you may have for the entries below.
374 :0:
375 * ? test -f ${MYEMAIL} && \
376     (${FORMAIL} -zxTo: -zxCc: |\
377     fgrep -i -f ${MYEMAIL})
378 | ${FORMAIL} -A"X-Folder: Default" >>${DEFAULT}
379
380 # Deliver email which passed spam filtering, but which wasn't sent to
381 # a recognizable personal email address of yours, to your "bulk mail"
382 # folder, for reading on a less-urgent basis.
383 :0:
384 | ${FORMAIL} -A"X-Folder: Bulk" >>${BULKFOLDER}
385
386
387 # Vacation - modified version of procmail example from "man procmailex"
388
389 # Drop duplicates
390 #:0 Wh: msgid.lock
391 #| ${FORMAIL} -D 65536 msgid.cache
392 #
393 #:0 Whc: vacation.lock
394 #* !^From: .*phd
395 #* !^FROM_MAILER
396 #* !^FROM_DAEMON
397 #* !^X-Loop: phd@phdru.name
398 #* !^X-Loop: phd@iskra.aviel.ru
399 #* !^From: "AviTicket" <support@aviel\.ru>
400 #* !^From: .* <lj_notify@livejournal\.com>
401 #* !^From: .*report_card@sbrf.ru
402 #| ${FORMAIL} -rD 65536 vacation.cache
403 #
404 #:0 ehc  # if the name was not in the cache - reply
405 #| (egrep -v '^From phd|^Return-Path: phd' | \
406 #   ${FORMAIL} -r -A"Precedence: junk" \
407 #      -A"X-Loop: phd@phdru.name" -A"X-Loop: phd@iskra.aviel.ru" \
408 #      -A"Content-Type: text/plain; charset=koi8-r"; \
409 #   echo "Hello!"; echo "";\
410 #   echo "   I am on vacation. This is an auto-generated reply. Your message has been"; \
411 #   echo "delivered to my mailbox. Thanks a lot. I will read it after 0th of ."; \
412 #   echo ""; \
413 #   echo "Здравствуйте."; echo ""; \
414 #   echo "   Я уехал в отпуск. Это автоматический ответ. Ваше сообщение было доставлено."; \
415 #   echo "в мой почтовый ящик. Большое спасибо. Я прочту его, когда вернусь 0 ."; \
416 #   echo ""; cat $HOME/.signature) | $SENDMAIL -oi -t