Policy Script 6: Calculate Spam Probability, Modify and Deliver

Modify Message

# import levels here
# attr NAME=Copy to quarantine and deliver if spam probability is 50%
# or more.
if not pmx_spam_prob :under 50 {
     pmx_replace_header "X-PerlMx-Spam" "Gauge=%%XGAUGE%%%%IGAUGE%%,
       Probability=%%PROB%%, Report='%%HITS%%'";
     pmx_file "Spam";
     pmx_replace_header "Subject" "[PMX:%%GAUGE%%] %%SUBJECT%%";
     stop;
}

Description:

  • If the pmx_spam_prob test finds the message has a spam probability of 50% or more:
    • pmx_replace_header adds, or alters, an "X-PerlMx-Spam" header. The %%XGAUGE%%%%IGAUGE%% variables add an "X" symbol to the header for every 10% of spam probability identified through the %%PROB%% variable. The %%HITS%% variable then adds a list of spam features found by the engine.
    • The pmx_file command then copies the message to the quarantine with the reason "Spam".
    • The pmx_replace_header command prefixes the message "Subject" header with "PMX:" and a "#" symbol for every 10% the message's spam probability exceeds 50%. At least one '#' is always appended to each message, indicating that the message contains 0-50% spam. The original message subject is added to the end of the header with the %%SUBJECT%% template variable.
    • The stop control ends message processing.

Deliver Message

# attr NAME=Add X-Header and deliver messages
else {
     pmx_replace_header "X-PerlMx-Spam" "Gauge=%%XGAUGE%%%%IGAUGE%%,
       Probability=%%PROB%%, Report='%%HITS%%'";
     stop;
}

Description:

  • If the pmx_spam_prob test finds the message has a spam probability of less than 50%:
    • pmx_replace_header adds, or alters, an "X-PerlMx-Spam" header. The %%XGAUGE%%%%IGAUGE%% variables add an "X" symbol to the header for every 10% of spam probability identified through the %%PROB%% variable. The %%HITS%% variable then adds a list of spam features found by the engine.
    • The stop control then ends message processing.