Spam Filtering: spamassassin Utility

The spamassassin utility is used to manage the Spamassassin spam filter through CLI. By using this utility, you can perform the following tasks:

Syntax

spamassassin <command> [<mail name>] [

<option_1> [<param>]

[<option_2> [<param>]]

…[<option_N> [<param>]]

]

Example

The following command line enables Spamassassin filter on mail name admin@example.com, enable the use of mail name-specific Spamassassin filter settings, set the minimum score of 3 for marking e-mail messages as spam and enables deleting spam messages automatically from the mail box:

# ./spamassassin --update admin@example.com -status true -personal-conf true -reject-spam true -hits 3

Commands

Command

Parameter

Description

Example

--update or -u

<mail name>

Updates the Spamassassin spam filter settings for a Plesk mail name.

To set the minimum score of 3 for marking e-mail messages as spam and deleting them automatically for Plesk mail name admin@example.com:

# ./spamassassin --update admin@example.com -hits 3 -reject-spam true

or

# ./spamassassin -u admin@example.com -hits 3 -reject-spam true

--update-server

 

Updates the Spamassassin spam filter settings for the Plesk server.

To set the minimum score of 5 for marking e-mail messages as spam as the default Plesk server setting:

# ./spamassassin --update-server -hits 5

--info or -i

<mail name>

Displays the Spamassassin spam filter settings for a Plesk mail name.

To display the Spamassassin spam filter settings for admin@example.com:

# ./spamassassin --info admin@example.com

or

# ./spamassassin -i admin@example.com

--info-server

 

Displays the Spamassassin spam filter settings for the Plesk server.

To display the Spamassassin spam filter settings for the Plesk server:

# ./spamassassin --info

--help or -h

 

Displays help on the use of this utility.

To see the help info on the use of the spamassassin utility:

# ./spamassassin -–help

Options

Option

Parameter

Description

Example

-status

true | false

Enables or disable the Spamassassin filter for a Plesk mail name.

To enable the Spamassassin filter for mail name admin@example.com:

# ./spamassassin -u admin@example.com -status true

-personal-conf

true | false

Enables or disables the use of mail name-specific (rather than server- wide) antispam filter settings for a mail name.

To enable the use of mail name-specific Spamassassin filter settings for mail name admin@example.com:

# ./spamassassin -u admin@example.com -personal-conf true

-hits

<float number>

Specifies the minimum score for an e-mail message to be marked as spam (the The score that a message must receive to qualify as spam parameter).

To set the minimum score of 3 for marking e-mail messages as spam for Plesk mail name admin@example.com:

# ./spamassassin --update admin@example.com -hits 3

-max-proc

<1|2|3|4|5>

The maximum number of simultaneously running spamd processes on server (the The maximum number of worker spamd processes to run (1-5) parameter).

To set the maximum number of simultaneously running spamd processes on server to 4:

# ./spamassassin --update-server -max-proc 4

-modify-subj

true | false

Enables or disables automatic modification of subject lines of messages marked as spam.

To enable automatic modification of subject lines of messages marked as spam and to specify the text to be inserted in the beginning of a subject line of each spam message as "***SPAM*** Score: _SCORE_ :":

# ./spamassassin -u admin@example.com -modify-subj true -modify-subj-text "***SPAM*** Score: _SCORE_ :"

-modify-subj-text

<string>

Specifies the text to be inserted in the beginning of a subject line of every message marked as spam. Type _SCORE_ if you want to include the message's spam score in the message subject line.

-reject-spam

true | false

Enables or disables deleting spam messages automatically (the Delete spam mail when it comes to mailbox parameter):

To enable deleting spam messages automatically:

# ./spamassassin --update admin@example.com -reject-spam true

-blacklist

add| del| enable| disable:<pattern 1>[,<pattern 2>,... [pattern N] *

Adds e-mail patterns to or deletes them from the Spamassassin's Black list. Enables or disables e-mail patterns in the Spamassassin's Black list.

The enable and disable parameters are used only with the --update command.

To add e-mail patterns *jane@example.com and ???user@*.example.net to the Spamassassin's black list:

# ./spamassassin --update admin@example.com -blacklist add:*jane@example.com,???user@*.example.net

-whitelist

add| del| enable| disable:<pattern 1>[,<pattern 2>,... [pattern N] *

Adds e-mail patterns to or deletes them from the Spamassassin's White list. Enables or disables e-mail patterns in the Spamassassin's White list.

The enable and disable parameters are used only with the --update command.

To add e-mail patterns *jane@example.com and ???user@*.example.net to the Spamassassin's white list:

# ./spamassassin --update admin@example.com -blacklist add:*jane@example.com,???user@*.example.net

* Non-ASCII characters are not allowed on the left of the @ sign in the e-mail pattern. E-mail patterns can include the "*" and "?" wildcard characters (for example, *@domain.com, user?@*.com). Non-ASCII parts of domain names must not contain wildcard characters.