Emmesmail utilizes a multi-faceted approach to junk mail that achieves a spam rejection rate > 99%, with fewer than 1% false positives (each rejection of valid email being considered a false positive). Emmesmail uses a whitelist, a blacklist, a Bayesian filter and an "appropriateness" filter. The whitelist and blacklist are user-specific locally generated files; Emmesmail does not import any global lists of spammers.
Here is an outline of how it works:
1) The first thing Emmesmail does is to check if the sender is included in the local whitelist, a list of senders previously determined not to be spammers. If so, the email is immediately delivered.
2) The next thing Emmesmail does is to check if the sender is included in the local blacklist, a list of senders previously found to be spammers. If so, the email is re-directed from the recipient's mailbox to the spam mailbox.
3) If the sender is not included in either the whitelist or blacklist, the entire email, including the header, is examined by a Bayesian filter modeled after that of Paul Graham.
4) If the Bayesian filter reports that the email is likely spam it is re-directed to the spam mailbox, appended to the database of spam emails (see information on Bayesian filtering below), and the sender added to the blacklist. If the email is thought not to be spam based upon Bayesian analysis, it is examined by a proprietary "appropriateness" filter, which examines the appropriateness of the words used in the email. This additionally catches a small number of spam emails where inclusion of random innocuous words has fooled the Bayesian filter.
5) If an email passes all the filtering, it is forwarded to the recipient's mailbox. Just having an email passed by the filtering process is not sufficient to add that email's sender to the whitelist. This only occurs once the email is saved by the user/recipient.
If upon checking the spam mailbox, if it is found that a mistake has been made and an innocent email has been diverted there, a single click will correct the mistake, deliver the mail to the intended recipient, and correct the databases.
Initially, Emmesmail rejects spam based upon Emmes Technologies' databases that come with the product, until such time as the user's databases become large enough to use.
When Emmesmail has determined that an email is spam, it can, if configured to do so, return the email to the spammer with a customizable "failure-to-deliver" message. Most authorities recommend that this feature not be used.
We found that in implementing the Bayesian filter described by Paul Graham, the following parameters needed to be defined.
Parameter |
Definition |
Value chosen |
MAXW |
Maximum number of tokens allowed in the hash table |
250000 |
MWDS |
Maximum number of words considered when calculating weights |
9000 |
WMIN |
Minimum length of a hash table token |
2 |
WMAX |
Maximum length of a hash table token |
40 |
PMIN |
Minimum probabilty of a token |
0.0001 |
PMAX |
Maximum probabilty of a token |
0.9999 |
PUNK |
Probability given a token not seen previously |
0.5 |
MINO |
Minimum number of times a token must appear in corpi to count |
4 |
MNUM |
Maximum number of emails in each corpus before thinning |
350 |
RNUM |
Number of emails remaining after thinning |
250 |
CUT |
Likelihood above which an email is considered spam |
0.5 |
NTW |
Number of words to weigh in likelihood calculation |
15 |
AFPB |
Anti false-positive bias factor |
1.0 |
- |
Characters which act as token separators |
\040, \011, \012, @, ?, / |
WMIN: Was set to 2 to avoid examining single letters.
WMAX: This eliminates long undecipherable tokens as occur with pdf documents.
PMIN, PMAX: Not 0 or 1, in order to avoid division by zero in the calculations. Also, if too small, a single word can carry too much weight.
MINO: A word must occur at least four times in our corpi to be significant with regard to determining whether an email is spam. Graham used five, but we felt four might allow one less spam to be passed during the filter's training period.
MNUM, RNUM: When one of our corpi gets to contain 350 emails, we reduce it to include only the 250 most recent and then add new ones until the total number is again 350.
CUT, NTW: Like the original Paul Graham filter, we calculate the likelihood of an email being spam according to the formula
Likelihood = pspam/(pspam + pnspam)
where pspam = w1*w2*w3*....wn, and pnspam = (1-w1)*(1-w2)*...(1-wn), and where the wn are the weights of the tokens in the email. Like the original Graham protocol, we arbitrarily consider only the NTW (15) most significant (closest to 0 or 1) weights in the calculation of likelihood, and we reject emails whose likelihood of spam is greater than CUT. We set CUT to 0.5, a logical choice. Setting CUT to 0.9 as in Graham's formulation, gives the same results, since, as he points out, the probabilities tend to be close to 0 or 1, with hardly any falling between 0.5 and 0.9.
AFPB: The anti false-positive bias factor. The weights, wn, strictly should be calculated according to the formula
wn = a/( a + b )
where a and b are the frequency of the word in the spam and non-spam
corpi respectively. The description of the original Graham filter recommended
counting the words in the non-spam corpus twice in order to reduce the incidence
of false positives. In our implementation this amounts to using the formula
wn = a/( a + b*AFPB )
where AFPB is 2.0. We tried values for AFPB varying from 3.0 to 0.4, before setting AFPB to 1.0, essentially eliminating it as a variable.
Our attempt to implement Graham's formulation exactly did not, initially, achieve as high a spam rejection rate as he reported. We made a number of changes to our spam filtering, introducing what we refer to as hierarchical filtering, which also includes in addition to Bayesian filtering, sender-filtering using a user-specific whitelist and blacklist, and use of an "appropriateness" filter. We currently are achieving results as good as those of Graham. This may be because of our modifications, but it may be that our initial failure to duplicate Graham's excellent results were due to programming bugs, which have since been eliminated.
Before using sender-filtering, we make certain to prevent our own email address from appearing on either the whitelist or blacklist, thus frustrating spammers who send spam that appears to come from the intended recipient.
We also made some small changes to our Bayesian filter. One such change was to exclude certain words from the weighting procedure. When calculating the likelihood that a given email is spam, Emmesmail ignores the following tokens when they appear in the head of the email; Jan, Feb, Mar, Apr, May, Jun, Jul, Aug, Sep, Oct, Nov, and Dec. Instituting this change alleviated the problem that a spate of spam emails at the beginning of a month was oftened followed by a false positive the first time a non-spam email arrived.
Since 2006, we have applied an appropriateness filter to those emails that pass the Bayesian filter. The logic behind this is as follows. Standard emails, both spam and non-spam, contain a relatively narrow range of vocabulary so that once the spam and non-spam corpi are reasonably-sized, the majority of the words in these emails are already in the stored corpi. Some spammers choose to put random words in their emails, and some of these pass the Bayesian filter. Non-spam senders almost never include large numbers of inappropriate words in their emails. In order to trap the tiny fraction of spam emails with inappropriate words that might otherwise not get caught, the appropriateness filter examines whether those emails passing the Bayesian filter contain a majority of "appropriate" words or not.
Year |
Spam Emails Rec. |
Spam Emails Rej. |
Rej. Rate (%) |
Valid Emails Rec. |
Valid Emails Rej. |
False Pos. (%) |