antispam:rules

This is where you manage custom anti-spam rules.

warden --task=antispam:rules --oper=<rule_add|rule_edit|rule_del|rules_check|rules_debug|rules_update|rules_compile>
Option
Value Description
--oper <string> The operation you want to perform. Operations: rule_add, rule_del, rules_check, rules_debug, rules_update, rules_compile
--data_source <string> The datasource file to use. Defaults to /etc/mail/spamassassin/local.cf
--id <string> The test name to edit. Only used by the rule_edit operation. When editing an exiting rule you must pass in all required fields over again.
--name <string> A test name, consisting of up to 22 uppercase letters, numbers, or underscores. Names that begin T_ refer to rules in testing.
--description <string> A more verbose description of the test, which is used in the reports generated by SpamAssassin. Typically, descriptions are up to 50 characters long.
--type <string> An indication of where to look. Tests can be applied to the message headers only, the message body only, uniform resource identifiers (URIs) in the message body, or the complete message. Types: body, header, mimeheader, uri, rawbody, full, meta, uri_block_cc, uri_block_cont, uri_block_cidr, uri_block_isp, uri_block_exclude
--value <string> A description of what to look for. Tests can specify a header to check for existence, a Perl regular expression pattern to match, a DNS-based blacklist to query, or a SpamAssassin function to evaluate.
--score <string> A score or scores for the test. Tests can have a single score that is always used, or they can have separate scores for messages that test positive under each of a set of conditions.
--tflags <string> Used to set flags on a test. These flags are used in the score-determination back end system for details of the test's behaviour.
--priority <int> Assign a specific priority to a test. All tests, except for DNS and Meta tests, are run in priority order. The default test priority is 0 (zero).
--reload <yes> Reload the service after saving settings.

Examples

// add a new rule
warden --task=antispam:rules --oper=rule_add --name='__IS_REDIRECT' --description='Detect if mail is a redirect' --type=header --value='Return-Path =~ /^<SRS0/i'

// rename an existing rule from __IS_REDIRECT to __IS_FORWARD
warden --task=antispam:rules --oper=rule_edit --id='__IS_REDIRECT' --name='__IS_FORWARD' --type=header --value='Return-Path =~ /^<SRS0/i'

// delete a rule
warden --task=antispam:rules --oper=rule_del --name='__IS_REDIRECT'