~dricottone/mail-filters

ref: 8bd6cd527866dc05c8022fd128c64fa96b2af9ee mail-filters/README.md -rw-r--r-- 2.2 KiB
8bd6cd52Dominic Ricottone Fix pattern for author name in mailman digest summary 4 years ago
                                                                                
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
# mail-filters

A set of text processing scripts that 'clean' plaintext email messages. This includes

 + removing cruft and repetitive text
 + removing non-plaintext MIME parts
 + inserting ANSI color codes
 + standardizing whitespace



## Installation

Run `sudo make install`. All it's going to do is copy the filters to /usr/local/share, though. I don't know why I even wrote this.



## Uninstallation

Run `make uninstall`. Again, all we're doing is copying files... This is a bit much...



## Recommended aerc configuration:

In `aerc.conf`:

```
[filters]
text/html                =path/to/html.sh
from,Archive of Our Own  =path/to/ao3.awk
from,FanFiction          =path/to/fanfiction.awk
to,~.@lists.ubuntu.com   =path/to/ubuntu.awk
to,~.@lists.debian.org   =path/to/debian.awk
from,~.@freebsd.org      =path/to/freebsd.awk
from,~.+@googlegroups.com=path/to/googlegroups.awk
from,~.+@archlinux.org   =path/to/mailman.awk
from,~.+@python.org      =path/to/mailman.awk
from,~.+@gnu.org         =path/to/mailman.awk
text/*                   =cat
```



## Recommended mutt configuration

In `muttrc`:

```
set display_filter = "path/to/filter.sh"
```

And in `filter.sh`:

```
tmp=$(mktemp /tmp/filter.XXXXXXXX)
cat > "$TMP"

if grep --quiet -e '^From: Archive of Our Own' "$TMP"; then
  cat "$TMP" | path/to/ao3.awk
elif grep --quiet -e '^From: FanFiction' "$TMP"; then
  cat "$TMP" | path/to/fanfiction.awk
elif grep --quiet -e '^To:.*@lists.ubuntu.com' "$TMP"; then
  cat "$TMP" | path/to/ubuntu.awk
elif grep --quiet -e '^To:.*@lists.debian.org' "$TMP"; then
  cat "$TMP" | path/to/debian.awk
elif grep --quiet -e '^From:.*@freebsd.org' "$TMP"; then
  cat "$TMP" | path/to/freebsd.awk
elif grep --quiet -e '^From:.*@googlegroups.com' "$TMP"; then
  cat "$TMP" | path/to/googlegroups.awk
elif grep --quiet -e '^From:.*@archlinux.org' "$TMP"; then
  cat "$TMP" | path/to/mailman.awk
elif grep --quiet -e '^From:.*@python.org' "$TMP"; then
  cat "$TMP" | path/to/mailman.awk
elif grep --quiet -e '^From:.*@gnu.org' "$TMP"; then
  cat "$TMP" | path/to/mailman.awk
else
  cat "$TMP"
fi

rm -f "$TMP"
```



## License

All materials of this repository are licensed under BSD-3. A copy of this license is included in the file LICENSE.md.