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