|
1 ################################################################ |
|
2 # Here we go.... # |
|
3 # my very own mail-mangler # |
|
4 ################################################################ |
|
5 |
|
6 ################################################################ |
|
7 # Updated to have working URLs and arbitrarily version-bumped # |
|
8 # to 1.2 on the grounds it matched the mutt version. Very # |
|
9 # little beyond URLs and list addresses has changed. # |
|
10 # 2002-03-21. # |
|
11 ################################################################ |
|
12 |
|
13 |
|
14 ################################################################ |
|
15 # In the spirit of the net, 90% of this came from other people # |
|
16 # and the remaining 10% might be from me. Most of the 90% # |
|
17 # came from these sources: # |
|
18 # # |
|
19 # "Getting started with procmail" at # |
|
20 # http://www.spambouncer.org/proctut.shtml # |
|
21 # http://www.spambouncer.org/procmail.rc # |
|
22 # ...by Catherine A. Hampton. # |
|
23 # # |
|
24 # man procmail (overview) # |
|
25 # man procmailrc (writing the procmailrc) # |
|
26 # man procmailex (example recipes) # |
|
27 # man formail (especially for splitting digests) # |
|
28 # # |
|
29 # and .procmailrcs from several friends. Thanks, folks, # |
|
30 # especially to the one who had more patterns which sent # |
|
31 # things to /dev/null than to mailboxes, for showing me # |
|
32 # what true impatience with email was like! # |
|
33 ################################################################ |
|
34 |
|
35 ################################################################ |
|
36 # Procmailrc files have two parts. First you tell it where # |
|
37 # everything lives. Then you tell it the recipes. # |
|
38 ################################################################ |
|
39 |
|
40 ########################################## |
|
41 # Varibiggles and where everything lives # |
|
42 ########################################## |
|
43 |
|
44 ################################################################ |
|
45 # All of these will work quite happily without changing for # |
|
46 # Red Hat Linux 6.0 through to 7.2.They won't necessarily work # |
|
47 # for other flavours without changing paths. See the "Getting # |
|
48 # started with procmail" doc I mentioned above for the likely # |
|
49 # settings for them in other environments. It has a list :) # |
|
50 ################################################################ |
|
51 |
|
52 ################################################################ |
|
53 # Since I installed procmail, I have changed from using # |
|
54 # sendmail to using exim. Because I can understand the config # |
|
55 # file. If you use exim, you may need to tweak the config file # |
|
56 # as I did. If you do, then check you are reading the docs for # |
|
57 # the right version of exim! This worked for me: # |
|
58 # # |
|
59 # http://www.exim.org/exim-html-3.20/doc/html/spec_18.html # |
|
60 # and look for procmail. It's in the example for the 'pipe # |
|
61 # transport'. Just paste it into /etc/exim.conf. # |
|
62 ################################################################ |
|
63 |
|
64 SHELL=/bin/bash |
|
65 # Have to have this one (or whatever your shell is) |
|
66 # Best bet is bash or sh. |
|
67 |
|
68 LINEBUF=4096 |
|
69 # Magic. Apparently it burps on long lines if you don't |
|
70 # put this in. |
|
71 |
|
72 PATH=/bin:/usr/bin:/usr/local/bin |
|
73 # Where procmail looks for stuff. Works for RH 6.0, 6.1 |
|
74 # and most other Linux settings I've seen. |
|
75 |
|
76 VERBOSE=off |
|
77 # Change to 'on' to get _long_ procmail log. |
|
78 # NB: if this is short, I don't want to see long: I get |
|
79 # a one-line summary for every email procmail looks at! |
|
80 |
|
81 MAILDIR=$HOME/Mail |
|
82 # Not where your mail arrives on the machine. Where |
|
83 # procmail will assume all the folders you mention in |
|
84 # your recipes goes. Make sure your email-reading |
|
85 # program also knows about it. (I understand $HOME/Mail |
|
86 # is pretty standard, however.) |
|
87 |
|
88 LOGFILE=$HOME/Mail/procmaillog |
|
89 # I don't think this needs to be in your Mail folder, |
|
90 # but my mail-reader (mutt) is great at different |
|
91 # sorting, so I put the log into the mail directory :) |
|
92 # Note learned through experience: if you leave this file |
|
93 # too long, it will end up with tens of thousands of |
|
94 # messages. Mutt is not always -that- good at sorting |
|
95 # that lot quickly :) |
|
96 |
|
97 FORMAIL=/usr/bin/formail |
|
98 # 'formail'. Part of the procmail package. Correct |
|
99 # the path if this isn't where it lives for you. |
|
100 # ('which formail' may well tell you.) |
|
101 |
|
102 SENDMAIL=/usr/sbin/sendmail |
|
103 # As with formail, tells procmail where to look for |
|
104 # sendmail. If sendmail isn't there, mail transfer |
|
105 # might be handled by a different program. Ask |
|
106 # your sysadmin :) If you are your own sysadmin, |
|
107 # then I hope you know. |
|
108 # Subsequent to writing that, I have learned that this |
|
109 # file is provided (with this name) by other MTAs too. |
|
110 # I now use Exim (see note above) and this file is still |
|
111 # there, courtesy of exim. |
|
112 |
|
113 |
|
114 ############################ |
|
115 # The recipes - I hope... # |
|
116 ############################ |
|
117 |
|
118 ################################################################ |
|
119 # Gods know how this works. But it's very useful. If you get # |
|
120 # email that is sent simultaneously to you and to two other # |
|
121 # lists, this will nuke two of those so that you only see it # |
|
122 # once. Came from 'man procmail'. # |
|
123 ################################################################ |
|
124 |
|
125 # Nuke duplicate messages |
|
126 :0 Wh: msgid.lock |
|
127 | $FORMAIL -D 8192 msgid.cache |
|
128 |
|
129 ################################################################ |
|
130 # Next two are from the 'Getting started with procmail' doc. # |
|
131 # I'm not too sure about how they work, but they look handy... # |
|
132 ################################################################ |
|
133 |
|
134 # Create a backup cache of 200 most recent messages in case of |
|
135 # mistakes (yes, you can change the 200 to 20 or 400 or whatever |
|
136 # you want) |
|
137 :0 c |
|
138 backup |
|
139 |
|
140 :0 ic |
|
141 | cd backup && rm -f dummy `ls -t msg.* | sed -e 1,200d` |
|
142 |
|
143 # Regenerate "From" lines to make sure they are valid |
|
144 :0 fhw |
|
145 | formail -I "From " -a "From " |
|
146 |
|
147 |
|
148 ################################################################ |
|
149 # For testing shit - I picked a subject line that no-one would # |
|
150 # send me and then tried different recipes on the results, and # |
|
151 # then sent myself a whole pile of email about grobblefruit, # |
|
152 # with different recipes here, to see what happened when I # |
|
153 # tried different headers and so on. # |
|
154 ################################################################ |
|
155 |
|
156 :0: |
|
157 * ^Subject: Test grobblefruit |
|
158 IN.testing |
|
159 |
|
160 |
|
161 ################################################################ |
|
162 # Mailing lists # |
|
163 # # |
|
164 # I think this is the thing that most people who finally get # |
|
165 # procmail want to know about: how to get different messages # |
|
166 # from different mailing lists into different folders. This is # |
|
167 # where all that MAILDIR stuff comes from. All the folders I # |
|
168 # name in here are all created off whatever directory I filled # |
|
169 # in as the MAILDIR at the start. And no, they don't suddenly # |
|
170 # appear the instant you edit this file. They only appear when # |
|
171 # procmail finds mail that should go in them. # |
|
172 # # |
|
173 # You can have more than one recipe sending email into the # |
|
174 # same folder, btw, yes. # |
|
175 # # |
|
176 # General useful (?) comments: # |
|
177 # The "^Resent-From: " pattern works wonderfully on # |
|
178 # lists which generate it. # |
|
179 # Making the folder not -quite- the list name means you # |
|
180 # can save mail from it to a folder named for the list. Can # |
|
181 # be handy. # |
|
182 # Some lists are indeed a pig to catch everything with. # |
|
183 # "TO" is different from "To" and you mustn't put a # |
|
184 # a space after "TO". It catches "To: " and "Cc: ", I # |
|
185 # think. Very handy. But it doesn't catch everything. If # |
|
186 # it's a mailman list, don't use it and see below. # |
|
187 # Mailman-run lists all seem to have a Sender: header # |
|
188 # which is very useful to sort with. Just add -admin onto # |
|
189 # the name of the mailing list. # |
|
190 # Even more useful for mailman-run lists turns out to be # |
|
191 # "X-BeenThere: [email protected]" # |
|
192 ################################################################ |
|
193 |
|
194 ################################################################ |
|
195 # I hardly use TO now, but here's an example in case. # |
|
196 ################################################################ |
|
197 |
|
198 :0: |
|
199 * ^[email protected] |
|
200 IN.lynx-dev |
|
201 |
|
202 ########### |
|
203 # bugtraq # |
|
204 ########### |
|
205 |
|
206 :0: |
|
207 * ^Sender:.*Bugtraq List |
|
208 IN.bugtraq |
|
209 |
|
210 ######################### |
|
211 # gnome CVS commit list # |
|
212 ######################### |
|
213 |
|
214 :0: |
|
215 * X-BeenThere: [email protected] |
|
216 IN.cvs-commits |
|
217 |
|
218 |
|
219 ############## |
|
220 # gnome-list # |
|
221 ############## |
|
222 |
|
223 :0: |
|
224 * ^X-BeenThere: [email protected] |
|
225 IN.gnome-list |
|
226 |
|
227 |
|
228 ################## |
|
229 # gnome-doc-list # |
|
230 ################## |
|
231 |
|
232 :0: |
|
233 * ^X-BeenThere: [email protected] |
|
234 IN.gnome-doc-list |
|
235 |
|
236 |
|
237 ############################################################### |
|
238 # linuxchix lists: there are several mailing lists here: see # |
|
239 # the end of this file for the different ways to deal with # |
|
240 # heavy traffic lists with digest options. # |
|
241 ############################################################### |
|
242 |
|
243 :0: |
|
244 * ^X-BeenThere: [email protected] |
|
245 IN.linuxchix |
|
246 |
|
247 :0: |
|
248 * ^X-BeenThere: [email protected] |
|
249 IN.linuxchix |
|
250 |
|
251 :0: |
|
252 * ^X-BeenThere: [email protected] |
|
253 IN.linuxchix |
|
254 |
|
255 |
|
256 ################################################# |
|
257 # This is what I consider advanced stuff: this # |
|
258 # one doesn't put the digest straight into a # |
|
259 # folder. Instead it runs 'formail +1 -ds', # |
|
260 # which splits the digest into its original # |
|
261 # messages, and then puts the results of that # |
|
262 # into the folder. # |
|
263 # # |
|
264 # The address is way way out of date, but I am # |
|
265 # not sure of the current digest address, so I # |
|
266 # have left it. # |
|
267 # # |
|
268 # It is commented out because I actually read # |
|
269 # the main list, not the digest, these days. # |
|
270 ################################################# |
|
271 |
|
272 # :0: |
|
273 # * ^[email protected] |
|
274 # | formail +1 -ds >> IN.linuxchix |
|
275 |
|
276 |
|
277 ############## |
|
278 # mutt-users # |
|
279 ############## |
|
280 :0: |
|
281 * ^[email protected] |
|
282 IN.mutt-users |
|
283 |
|
284 :0: |
|
285 * ^Sender: [email protected] |
|
286 IN.mutt-users |
|
287 |
|
288 |
|
289 ################################################# |
|
290 # Procmail list # |
|
291 # ...be aware that everyone on this list # |
|
292 # seems to have monster spam filters and thus # |
|
293 # to be completely unconcerned at the huge # |
|
294 # amount of spam it gets: you will either need # |
|
295 # spam filters or tolerance to find the good # |
|
296 # stuff. (I am not subscribed now, but that was # |
|
297 # the case when I was.) # |
|
298 ################################################# |
|
299 |
|
300 :0: |
|
301 * ^[email protected] |
|
302 IN.procmaillist |
|
303 |
|
304 |
|
305 ####################################################### |
|
306 # Red Hat announce -- very handy for security updates # |
|
307 ####################################################### |
|
308 |
|
309 :0: |
|
310 * ^X-BeenThere: [email protected] |
|
311 IN.rh-announce |
|
312 |
|
313 :0: |
|
314 * ^X-BeenThere: [email protected] |
|
315 IN.rh-announce |
|
316 |
|
317 |
|
318 ######################### |
|
319 # windowmaker: wm-users # |
|
320 ######################### |
|
321 |
|
322 :0: |
|
323 *^From [email protected] |
|
324 IN.wm-user |
|
325 |
|
326 ################################################################ |
|
327 # Splitting digests # |
|
328 # # |
|
329 # You don't need to do this, but this seems to be another very # |
|
330 # popular thing to do with procmail. If you're on mailing # |
|
331 # lists using the digest option, sometimes you may want to # |
|
332 # split the digests back up into the original emails. There is # |
|
333 # (of course) more than one way to do this: # |
|
334 # # |
|
335 # (1) don't bother: just read through all the digest in one # |
|
336 # big lump. Simple, easy, and great until you find someone # |
|
337 # sent a 500-line postscript file or a giant jpg which got # |
|
338 # included into the digest :( # |
|
339 # # |
|
340 # (2) use a mail-reader such as mutt, and if you suddenly want # |
|
341 # to split a digest up, then whilst reading the message, hit # |
|
342 # | formail +1 -ds # |
|
343 # which will put the results into your main inbox. If you want # |
|
344 # it in a particular folder (like the one you're reading), do # |
|
345 # | formail +1 -ds >> foldername # |
|
346 # # |
|
347 # (3) make procmail (or formail, actually), split it up ready # |
|
348 # for you to read. # |
|
349 # # |
|
350 # So if you want to have each digest automatically split up # |
|
351 # by procmail as it arrives, and to read each message # |
|
352 # individually, then here's some examples of what you can put. # |
|
353 # The first two lines are exactly the same. The third one has # |
|
354 # a pipe (vertical line) symbol at the start, and then the # |
|
355 # command you're piping it through. # |
|
356 # # |
|
357 # Yes, I picked a notoriously heavy-traffic one for the first # |
|
358 # example... And it -should- work, but it's not a list I read, # |
|
359 # sorry! # |
|
360 # # |
|
361 # Instead of this: # |
|
362 # :0: # |
|
363 # * ^Sender: [email protected] # |
|
364 # IN.linux-kernel # |
|
365 # ...you want this: # |
|
366 # :0: # |
|
367 # * ^Sender: [email protected] # |
|
368 # | formail +1 -ds >> IN.linux-kernel # |
|
369 # # |
|
370 # Da-dah! That's all. # |
|
371 # # |
|
372 # And for those where the list name changes and that's what # |
|
373 # you're matching patterns on, instead of this: # |
|
374 # :0: # |
|
375 # * ^[email protected] # |
|
376 # IN.linuxchix # |
|
377 # ...you want this: # |
|
378 # :0: # |
|
379 * ^[email protected] # |
|
380 # | formail +1 -ds >> IN.linuxchix # |
|
381 # # |
|
382 # Magic :) # |
|
383 ################################################################ |
|
384 |
|
385 |
|
386 |
|
387 ################################################################ |
|
388 # That's it. Any email that doesn't match any of the recipes # |
|
389 # above goes into my usual place for email, which until I read # |
|
390 # it is /var/spool/mail/hobbit. Procmail appears to know about # |
|
391 # that without being told. # |
|
392 # # |
|
393 # Quick summary for adding your own or changing these: the # |
|
394 # general format for putting an email into a folder and not # |
|
395 # doing anything fancy to it first is: # |
|
396 # # |
|
397 # :0: # |
|
398 # * <what you're looking for> # |
|
399 # <where you're putting it> # |
|
400 # # |
|
401 # The ^ sign in my recipes is the sign procmail understands as # |
|
402 # "start of the line", so "^From" matches the word "From" when # |
|
403 # it's the start of a header. # |
|
404 # # |
|
405 # The "IN." at the start of folder names is not necessary: # |
|
406 # that's just my naming system. Stolen, like everything else, # |
|
407 # from a friend's example. It has the benefit that with my # |
|
408 # mail-reader (mutt), which sorts alphabetically, all of them # |
|
409 # show up first (capitals are earlier in the alphabet if # |
|
410 # you're a computer...) and I can save them easily: from # |
|
411 # IN.blah to blah. If you want to call the folders blah-spool, # |
|
412 # or just blah, then cool. That'll work, too. # |
|
413 # # |
|
414 # It is possible that now you have everything in different # |
|
415 # folders, you want to read with a cool program which does # |
|
416 # cool things like display by thread or which understands you # |
|
417 # when you tell it "These are mailing lists" and does handy # |
|
418 # things as a result. If you do, and you discover Mutt, you # |
|
419 # might want to look at my muttrc which is probably next to # |
|
420 # this file. # |
|
421 # # |
|
422 # Have fun! # |
|
423 # -- Telsa # |
|
424 ################################################################ |