Detecting Spam

The most common use for PureMessage is detecting spam. This snippet contains the following code:

if pmx_spam_prob :over 50 {
    pmx_replace_header "Subject" "[SPAM:%%GAUGE%%] %%SUBJECT%%";
    pmx_add_header "X-PMX-Spam" "Probability=%%PROB%%";
}

If a message's spam probability is greater than 50%, PureMessage will prefix the Subject header with a string like [SPAM:###], where each additional # character denotes 10% above the argument to pmx_spam_prob. Subject-style gauge. At least one '#' is always appended, indicating that the message contains 0-50% spam. In this example, a message with a spam probability of 60% would have its subject prefixed with [SPAM:##]. A message with only 50% probability would have its subject prefixed with [SPAM:#].

Also, if PureMessage deems the message to be spam, it adds an X-PMX-Spam header, which spells out the probability in full. The header might look like this:

X-PMX-Spam: Probability=63%