1 .\" $Id: t-prot.1,v 1.97 2005/02/24 23:34:29 jochen Exp $
3 .TH T-PROT "1" "Feb 2005" "T-PROT"
5 t-prot \- TOFU Protection - Display Filter for RFC 822 messages
7 .BI "t-prot [" OPTIONS "]..."
10 This program is a filter which shall improve the readability
11 for messages (emails and posts) by *hiding* some annoying parts,
12 e.g. mailing list footers, signatures, and TOFU (see definition below),
13 as well as squeezing sequences of blank lines or punctuation.
15 The filter is written in Perl and relies on input to be a single
16 message conforming to RFC 822 or it's successor, RFC 2822. Messages
17 conforming to RFCs 2045, 2046 and 2049 should be treated reasonably
20 For easy usage, you can download a file to be included in your ~/.muttrc:
21 .I http://www.escape.de/users/tolot/mutt/t-prot/muttrc.t-prot
23 And here is an example S-Lang macro to use t-prot from within slrn:
24 .I http://www.escape.de/users/tolot/mutt/t-prot/t-prot.sl
28 "ad footer directory":
29 Defines the directory which contains the advertisement list footers (one
30 footer per file) which are to be tested when removing them with options
35 This option is also needed if you do not want signature lengths to be
36 counted wrong or fullquotes get undetected when an ad footer is
37 appended at the bottom of the message (especially when using
43 "commercial signature":
44 Hides "footers" (signatures) from commercial email providers.
46 This option compares the last lines of the message body with any
47 footer file found in the directory specified with
49 (which is mandatory for this option). The comparison is done by perl's
56 This option is not needed if
60 .BR "\-\-bigq" [=n[,x]]
62 Blocks of quotes with more than n lines will be shrinked to x lines.
63 Defaults are 30 for n and 10 for x.
67 Squeezes a sequence of blank lines to two blank lines at maximum.
69 .BR "\-\-check" [=FLAGS]
70 Run checks. If successful, print an error message and quit with
71 an appropriate exit code. Useful e.g. for rejecting messages from
74 Flags are separated by commas (no whitespaces), and can be the
75 following (right now just one flag):
79 If the quoting ratio is n or more, the message is rejected. Must be
80 between 0 and 1, or else it is entirely disabled.
84 Print envelope info to syslog when bouncing TOFU contaminated email.
85 Default syslog facility is mail.debug. Requires
90 Tolerate unified diff (see
94 appended *after* the signature (which usually makes the signature too long
95 to be valid). Not entirely consequent but sometimes useful, e.g. at the
96 Linux kernel mailing list.
100 Squeezes a sequence of four or more dots, exclamation marks, or question marks
101 to only three dots or marks, respectively.
104 "enable aggressive ad footer matching":
105 With this option enabled t-prot makes footer detection really greedy: We
106 assume that commercial email providers aren't even frightened to append
107 changing texts *under* their ads which are appended to the message body.
108 Because these texts even have changing *lengths* we simply detect the
109 lines of the footer *anywhere* in the body of the message and assume that
110 everything below belongs to the footer. (Man, if life where always that
113 With this option even GMX ads should be easy to hide -- you buy this with
114 a slight performance hit (which is the reason this option is disabled by
115 default), and with the possibility that sometimes the algorithm is just a
119 This requires a directory with footer files to be given with option
120 .BR "\-A" =DIRECTORY.
123 "enable aggressive mailing list footer matching":
124 With this option enabled t-prot makes footer detection really greedy: Should
125 be helpful with broken list servers, or even if your email provider munges
126 the bodies of your messages.
128 Works similar to --ftr-ad, just that it is intended for mailing list footers.
131 This requires a directory with footer files to be given with option
132 .BR "\-L" =DIRECTORY.
136 Displays a short help text with a summary on all options, and exits.
140 Defines a file for input; the default input is from '-' i.e. STDIN.
144 Tries to fix those broken zig-zag-shaped lines wrapped around by some MUAs
145 which are known as "Kammquoting" in German.
147 Note: This option is considered stable by now. However, sometimes Kammquotes
148 should have been removed but weren't. Please send a bug report if this happens
149 to you (after carefully reading the BUGS file, that is).
152 Minimum line length for wrapped line detection on Kammquotes. Umm, don't
153 know how to explain this well without describing the complete algorithm
154 used. Please see the code.
156 Anyway, lower values make the algorithm more aggressive, higher values
157 make Kammquotes harder to detect. Default is 65.
163 Maximum line length for wrapped line detection on Kammquotes. Umm, don't
164 know how to explain this well without describing the complete algorithm
165 used. Please see the code.
167 Anyway, higher values make the algorithm more aggressive, lower values
168 make Kammquotes harder to detect. Default is 80.
174 Minimum length difference between two lines for wrapped line detection on
175 Kammquotes. Umm, don't know how to explain this well without describing
176 the complete algorithm used. Please see the code.
178 Anyway, lower values make the algorithm more aggressive, higher values
179 make Kammquotes harder to detect. Default is 20.
185 "list footer directory":
186 Defines the directory which contains the mailing list footers (one footer
187 per file) which are to be tested when removing them with the options
192 This option is also needed if you do not want signature lengths to be
193 counted wrong or fullquotes get undetected when a mailing list footer is
194 appended at the bottom of the message (especially when using
201 Hides "footers" (signatures) from mailing lists. Footer detection works like the
206 This requires a directory with footer files to be given with option
207 .BR "\-L" =DIRECTORY.
213 .B "\-\-lax\-security"
214 Allow insecure writing method. DO NOT USE UNLESS YOU REALLY KNOW WHAT
215 YOU ARE DOING. (This ugly workaround is needed for some early mutt versions
216 and should NEVER be used as a default, otherwise it will probably turn into
219 .BR "\-\-locale" =LOCALE
221 Here you can specify which locale to use. Right now this option is only
224 is specified, but this may change in future. You need the Perl module
233 with locales, t-prot will only work correctly if you specify the corresponding
237 You also have to make sure you are running t-prot
242 versions. T-prot detects
246 locales of the recent stable versions of those programs, earlier versions
247 might not work well with a recent version of t-prot. There are patches available
248 to make t-prot fit into environments with old
256 Hides TOFU as given by some Microsoft mailers. (You all surely know these
257 fullquotes beginning with
259 "----- Original Message -----"
261 and some header lines...)
264 Burn CPU cycles trying to be smart with MS style TOFU.
266 Please note that this is probably just a waste of time because most
267 MS Outlook users who do produce this kind of TOFU won't care about
268 making their messages the least bit readable or even predictable. So
269 this option will probably just be interesting for mutt message hooks
270 (to activate it on demand when you
271 .BR know " the sender tries to write legible messages)."
277 .BR "\-M, \-\-mua" =MUA
279 Turn on special treatment for some mail user agents. (Right now only
281 is supported, but more might be added in future.)
283 If your MUA is supported by this feature you must ensure t-prot makes
284 use of it when called from within your MUA to work as desired.
288 Define the file to be written *to*; the default output is to STDOUT.
290 If "NONE" is specified as file name, there will be no output at all (useful
291 if all you need is t-prot's exit code). Use something like "./NONE" if you
292 really want to write to a file of this name.
296 If we really find some TOFU, abort with exit code
298 Otherwise redirect the message to ADDRESS if given.
300 Intended for use from within mail delivery agents (MDAs) or mail transport
301 agents (MTAs), so the message bounces if TOFU is detected, and does not get
304 As an example for usage with
306 put this line into your alias file and invoke
309 notofu: |"/usr/local/bin/t-prot -mt -p=user@mydomain"
311 This will bounce messages for <notofu@domainname> if any TOFU is detected
312 inside the message, and deliver it to <user@mydomain> otherwise.
314 that TOFU is only detected if you specify
319 .B PLEASE be careful not to bounce messages to mailing lists!
322 "user defined bounce message for picky delivery":
323 You may specify your own bounce message to be returned when we try to deliver
324 an email and bounce it because there is TOFU inside.
327 Move pgp verification output to bottom; requires
330 .B \-\-pgp\-move\-vrf
331 Move pgp verification outout to bottom only if verification shows a good signature
332 and the signature could be verified as authentic (using a trust path). If there is
333 any problem with the signature, the pgp output should not be moved so the user is
334 more likely to notice. Requires
338 If gpg is terminated before finished (e.g. hitting Ctrl-C, or using
340 we cannot always detect if the check was interrupted. Though t-prot tries
341 to be smart, there will be false positives.
344 Hide non-relevant pgp key uids; requires
349 Hides all mail header lines.
352 "supression of overlong signatures":
353 Signatures are to be n lines (not including the one containing dash-dash-space)
354 or less. If there are more, it is probably not that spirited after all. So
355 with this option you trade it for a
359 If no n is given, default is 4. (\fINote\fR: We do not recommend using a
360 value other than 4. Consider this old-fashioned, but we actually do *like*
364 The line containing "-- " ist not counted when testing for an overlong
365 signature, but it is included when displaying how many lines were deleted.
368 "signature deletion":
369 Hides signatures, i.e. all lines after a "signature dashes" line,
370 i.e. a line with three characters: dash-dash-space (no more, no less).
372 .BR "\-\-sigsmax" [=n]
373 "maximum number of tolerated signatures":
374 Here you can define how many signatures you accept to be treated as such.
375 (Most significant behaviour is when microsoft style quotes are removed.
376 Experts please see the code for the more subtle implications of this
379 Leave empty or specify zero to have an unlimited number of sigs.
383 "SpamAssassin workaround":
384 SpamAssassin (available at
385 .IR http://spamassassin.org/ ") often is configured that it adds some"
386 lines to the message body containing information about the spam criteria
387 which were found matching for the message. This option enables an extra
388 test to avoid false positives for Microsoft style TOFU on such messages.
392 Hides "traditional style" TOFU, where each line begins with an
393 indent string like "> ".
395 (You may edit the indent pattern in the script itself to suit your needs,
401 "whitespace deletion":
402 Hides trailing whitespace (sequences of space and tab).
403 CAVEAT: This may lead to interesting effects with crossposts
404 between mailing lists or with undetected signature attempts.
406 .B "\-v, \-\-version"
408 Prints the current version number and release date, and exit.
410 TOFU is an abbreviation which mixes German and English words;
411 it expands to "text oben, full-quote unten" which means
412 "text above - full quote below" and describes the style of so
413 many users who let their mailer or newsreader quote everything
414 of the previous message and just add some text at the top;
415 obviously they think that quoted text must not be changed at all.
416 This is quite annoying as it needlessly sends a lot of data
417 even when it is not required. Some editing of messages is desired.
418 Please point these people to the page
419 .I http://www.river.com/users/share/etiquette/edit.html
424 I want to make my mailing list footer files match more different mailing
425 list footers. Can I use regular expressions, or how can I accomplish that?
428 Nope, regexp's do not work here. The comparison is made by the perl builtin
432 for more detailed info), so you must exactly match the beginning of the
433 line. The longer the line you specify, the more precise the match; if
434 your line is empty you match unconditionally.
438 I use the options -l and -L to supress mailing list footers when
439 displaying messages in
441 This does work sometimes, but sometimes it does not: the footer is not
442 detected, and therefore full quotes are not deleted and signatures are
443 detected as too long (which they aren't).
446 This might occur if the message is badly encoded, so mutt cannot resolve
447 all encoded characters, e.g. if you have an encoded message on a mailing
448 list, and majordomo appends a mailing list footer in a different encoding
449 (or even plain us-ascii). "-- " simply does not match "--=20".
451 Another problem are non-us-ascii characters. Just avoid them, and
452 everything should work fine.
454 See the preceding Q+A for a solution.
458 I want to write a message which contains parts that should *not* be
459 deleted even when filtered with t-prot. Is this possible?
462 Yes, but please do not spread word of it. Make unobstrusive use of the
469 This line is protected from being filtered by t-prot !!!!!!!
473 Text coming now is not.
474 .SH AUTHOR AND COPYRIGHT
475 Written by Jochen Striepe <t-prot@tolot.escape.de>.
477 Copyright \(co 2001-2005 Jochen Striepe.
479 This is free software; you may use the source to whatever you like.
480 Just keep in mind to mention the original source of the script and the manpage
481 when you give it away. There is NO warranty; not even for MERCHANTABILITY or
482 FITNESS FOR A PARTICULAR PURPOSE.
483 .SH IDEAS AND INSPIRATION
484 Many good ideas, bug reports and support from (in alphabetical order) Bjoern
485 Buerger, Bjoern Laessig, Christian Borss, Gerfried Fuchs, Martin Neitzel, Martin
486 Dietze, Ralf Doeblitz, Sven Guckes and many more (see the ChangeLog for active
487 contributors). Many thanks to all of them!
489 Many thanks to Gerhard H. Wrodnigg who uses a TOFU protection script
490 in order to keep the responses to his cancel bot reasonably short. The
491 entire inspiration for this hack came from the "TOFU protection" line of
492 his script on many usenet postings.
494 You can get the latest version from
495 .IR http://www.escape.de/users/tolot/mutt/ .
497 Please note that t-prot development happens on
498 .BR "current stable perl versions only" .
499 If you do run t-prot on earlier (or unstable) perl versions, you might
500 encounter perl compiler bugs (or funny t-prot behaviour). One solution
501 is to upgrade your perl, another is simply to write a bug report. If
502 you do not run a current perl version, please include this information
503 in your bug report. Thank you.
505 There is a problem when mutt gives a PGP verified or even a multipart
506 message to t-prot: The information where the PGP encrypted/signed data
507 or even attachments begin and end is plainly embedded in the text, not
508 really cleanly recognizeable for t-prot. The problem should be worked
509 around by now, please send a bug report if it does not work for you.
511 There probably are many more bugs in this piece of software. Feel free to
514 so you have the sources. Ah, and while you're at it, please drop a note to
515 the author - thanks in advance!
517 Please send your bug report to <t-prot-bugs@tolot.escape.de>.
521 section). Beside that, all main features should be implemented by now.
525 and the part about "display_filter",
528 RFCs 822, 2045, 2046, 2049, and 2822,
529 .I http://got.to/quote/
531 .I http://www.river.com/users/share/etiquette/edit.html
532 (the Learn To Edit Messages HowTo has found a new home).