Scroll to navigation

Mail::SpamAssassin::Plugin::Shortcircuit(3pm) User Contributed Perl Documentation Mail::SpamAssassin::Plugin::Shortcircuit(3pm)

NAME

Mail::SpamAssassin::Plugin::Shortcircuit - short-circuit evaluation for certain rules

SYNOPSIS

  loadplugin     Mail::SpamAssassin::Plugin::Shortcircuit
  report Content analysis details:   (_SCORE_ points, _REQD_ required, s/c _SCTYPE_)
  add_header all Status "_YESNO_, score=_SCORE_ required=_REQD_ tests=_TESTS_ shortcircuit=_SCTYPE_ autolearn=_AUTOLEARN_ version=_VERSION_"

DESCRIPTION

This plugin implements simple, test-based shortcircuiting. Shortcircuiting a test will force all other pending rules to be skipped, if that test is hit. In addition, a symbolic rule, "SHORTCIRCUIT", will fire.

Recommended usage is to use "priority" to set rules with strong S/O values (ie. 1.0) to be run first, and make instant spam or ham classification based on that.

CONFIGURATION SETTINGS

The following configuration settings are used to control shortcircuiting:

Shortcircuiting a test will force all other pending rules to be skipped, if that test is hit.

Recommended usage is to use "priority" to set rules with strong S/O values (ie. 1.0) to be run first, and make instant spam or ham classification based on that.

To override a test that uses shortcircuiting, you can set the classification type to "off".

Note that DNS and other network lookups are launched when SA reaches priority -100. If you want to shortcircuit scanning before any network queries are sent, you need to set lower than -100 priority to any such rule, like -200 as in the examples below.

Shortcircuited test will be automatically set to priority -200, but only if the original priority is unchanged at default 0.

Shortcircuits the rest of the tests, but does not make a strict classification of spam or ham. Rather, it uses the default score for the rule being shortcircuited. This would allow you, for example, to define a rule such as

  body TEST /test/
  describe TEST test rule that scores barely over spam threshold
  score TEST 5.5
  priority TEST -200
  shortcircuit TEST on
    

The result of a message hitting the above rule would be a final score of 5.5, as opposed to 100 (default) if it were classified as spam.

Disables shortcircuiting on said rule.
Shortcircuit the rule using a set of defaults; override the default score of this rule with the score from "shortcircuit_spam_score", set the "noautolearn" tflag, and set priority to -200. In other words, equivalent to:

  shortcircuit TEST on
  priority TEST -200
  score TEST 100
  tflags TEST noautolearn
    
Shortcircuit the rule using a set of defaults; override the default score of this rule with the score from "shortcircuit_ham_score", set the "noautolearn" and "nice" tflags, and set priority to -200. In other words, equivalent to:

  shortcircuit TEST on
  priority TEST -200
  score TEST -100
  tflags TEST noautolearn nice
    
When shortcircuit is used on a rule, and the shortcircuit classification type is set to "spam", this value should be applied in place of the default score for that rule.
When shortcircuit is used on a rule, and the shortcircuit classification type is set to "ham", this value should be applied in place of the default score for that rule.
When shortcircuit_min_ham_score is set, SpamAssassin will stop processing when total score will be lower then this value.
When shortcircuit_max_spam_score is set, SpamAssassin will stop processing when total score will be higher then this value.

TAGS

The following tags are added to the set available for use in reports, headers etc.:

  _SC_              shortcircuit status (classification and rule name)
  _SCRULE_          rulename that caused the shortcircuit 
  _SCTYPE_          shortcircuit classification ("spam", "ham", "default", "none")

SEE ALSO

"https://issues.apache.org/SpamAssassin/show_bug.cgi?id=3109"

2024-06-10 perl v5.38.2