-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmail-sort.html
180 lines (171 loc) · 8.14 KB
/
mail-sort.html
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
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<title>Mail Sorting Strategies</title>
<link rel="stylesheet" href="style.css" type="text/css">
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
</head>
<body class="page">
<h1 class="title">Mail Sorting Strategies</h1>
<p>
Think a moment about how you read mail. If you're like me,
there are certain people whose messages you want to read right
away and others whose messages you'd rather not read at all. If
you are subscribed to a mailing list or two, you might want to
group those messages together. Some messages you'll want to
keep for years and be able to find after a few minutes of
searching. Some messages are from colleagues and others are
from friends. Your work life and home life are
separate—why isn't your work and home mail? If you
recognize these small frustrations using email, you, my friend,
need automated mail sorting.
</p>
<p>
Most mail programs offer the option (if you can find it) to sort
messages into different mailboxes based on information found in
email headers. For instance a really simple strategy would be
to sort mail to boxes based on the From header. If I sent you a
message, your mail program might create a box named "Jon
Ericson" and move my messages there. Or you could sort everyone
who sends you mail into the "Friends" and "Foes" mailboxes. As
a matter of fact, most of my sorting rules make use of the From
header. I can normally predict what sort of things a
person will mail me about.
</p>
<p>
If you want to keep mailing list messages together, the From
header is unreliable and awkward. That's because list server
software preserves the From header when it forwards mail to its
list. Fortunately it normally adds other headers for the
purpose of allowing easy sorting and as a sort of signature.
A fairly reliable thing to look for is the address of the list
in the Sender header.
</p>
<p>
So far we've looked at "whitelist" strategies: sorting messages
from people you want to receive messages from. Most people are
driven to mail sorting because they want to "blacklist" certain
types of messages. Most of us would like to never again see the
get-rich-quick schemes, Viagra and diploma sales pitches,
invitations to visit pornographic web pages, and
who-knows-what-they-say foreign language emails. The From
header is rarely useful, since spammers tend to use some bogus
Hotmail, Yahoo! or AOL address.
</p>
<p>
In the epic battle between large ISPs (who get the majority of
complaints) and the spammers (who are attracted to the huge
number of accounts) victory goes to the innovator. When ISPs
blocked spam with identical Subject headers to thousands of
subscribers, spammers began including random numbers pushed to
the end by spaces. So a simple blacklist rule is to junk
subjects with more than 2 spaces in a row.
</p>
<p>
Of course you can also censor based on certain words in the
Subject. My earliest spam filter was to junk messages with the
string 'sex' in the Subject. Naturally I lost a message a few
days later because one of my colleagues misspelled consecutive.
The first lesson to learn is that you should <em>never</em>
throw mail away without glancing over it first. For this
reason, my blacklisted mail goes to the Junk mailbox, not to the
trash.
</p>
<p>
The second lesson is to be sure to filter <em>words</em> not
<em>strings</em>. Maybe I don't want to read what strangers
might have to say about <em>sex</em>, but perhaps I would be
interested in messages about <em>sex</em>tants. (On the other
hand I suppose I don't care about <em>sex</em>tons.)
</p>
<p>
Perhaps the most important lesson though is to whitelist filter
aggressively before you blacklist. You know from deduction that
emails from coworkers are usually about work. You know from
induction that emails about sex are usually spam. So your
whitelist rules tend to be more certain than your blacklist
rules.
</p>
<p>
Here's the code (Emacs lisp) that splits my mail:
<br/>
<br/>
<code>
(setq nnmail-split-methods 'bbdb/gnus-split-method)
(setq nnmail-split-fancy
'(| (: nnmail-split-fancy-with-parent)
(from mail "INBOX")
("sender" "owner-advanced-sl@multimanpublishing.com" "ASL")
("sender" "cygwin-announce-owner@cygwin.com" "Cygwin")
("sender" "xemacs-announce-admin@xemacs.org" "xemacs")
("mailing-list" "perl.org" "perl")
(to "all.personnel@list.jpl.nasa.gov" "NASA")
("mailing-list" "swish" "swish")
("content-type" "text/html\\|big5\\|gb2312\\|ks_c_.*" "Junk")
("subject" ".*[1²°¶÷].*\\| [0-9A-Z]\\|panties" "Junk")
("subject" "earn" "Junk")
("message-id" "tw" "Junk")
(from "jpl.nasa.gov" "NASA")
(from "raytheon.com" "Raytheon")
("precedence" "bulk" "Junk")
(to "Ericson\\|jlericson" "INBOX")
(to "jlericson@yahoo.com" "INBOX")
; ("x-mindspring-loop" "jlericson@yahoo.com" "INBOX")
"Junk"))
</code>
</p>
<p>
The first line sorts mail from people I know using <em><a
href="http://bbdb.sourceforge.net/">Insidious Big Brother
Database</a></em>. It's basically an address book that links
with <a href="http://www.gnus.org">Gnus</a> (the News/Mail
reader for Emacs). <br/> <br/>
<code>
(setq nnmail-split-methods 'bbdb/gnus-split-method)
</code>
</p>
<p>
Then I sort mailing lists:
<br/>
<br/>
<code>
(setq nnmail-split-fancy
'(| (: nnmail-split-fancy-with-parent)
(from mail "INBOX")
("sender" "owner-advanced-sl@multimanpublishing.com" "ASL")
("sender" "cygwin-announce-owner@cygwin.com" "Cygwin")
("sender" "xemacs-announce-admin@xemacs.org" "xemacs")
("mailing-list" "perl.org" "perl")
(to "all.personnel@list.jpl.nasa.gov" "NASA")
("mailing-list" "swish" "swish")
</code>
</p>
<p>
Next, get rid of likely spam:
<br/>
<br/>
<code>
("content-type" "text/html\\|big5\\|gb2312\\|ks_c_.*" "Junk")
("subject" ".*[1²°¶÷].*\\| [0-9A-Z]\\|panties" "Junk")
("subject" "earn" "Junk")
("message-id" "tw" "Junk")
(from "jpl.nasa.gov" "NASA")
(from "raytheon.com" "Raytheon")
("precedence" "bulk" "Junk")
(to "Ericson\\|jlericson" "INBOX")
(to "jlericson@yahoo.com" "INBOX")
; ("x-mindspring-loop" "jlericson@yahoo.com" "INBOX")
"Junk"))
</code>
</p>
<hr> <a href="http://www.geocities.com/jlericson">Home</a>
<address><a href="mailto:jlericson@yahoo.net">Jon
Ericson</a></address>
<!-- Created: Tue Feb 12 18:39:25 PST 2002 -->
<!-- hhmts start -->
Last modified: Mon Feb 23 18:07:17 PST 2004
<!-- hhmts end -->
</body>
</html>
<!-- LocalWords: tants
-->