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:

Usage

spamassassin <command> [<mail_name>] [
<option_1> [<param>]
[<option_2> [<param>]]
… [<option_N> [<param>]]
]

Example

The following command enables Spamassassin filter on the mail account JDoe@example.com, enables the use of mail name-specific Spamassassin filter settings, sets the minimum score for marking email messages as spam to 3 and enables deleting spam messages automatically from the mailbox:

# ./spamassassin --update JDoe@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 on a Plesk mail account.

To set the minimum score for marking email messages as spam and deleting them automatically for JDoe@example.com to 3:

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

or

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

--update-server

 

Updates the Spamassassin spam filter settings on the Plesk server.

To set the minimum score for marking email messages as spam for the Plesk server to 5:

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

--info or -i

<mail_name>

Displays the Spamassassin spam filter settings of a Plesk mail account.

To view the Spamassassin spam filter settings of JDoe@example.com:

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

or

# ./spamassassin -i JDoe@example.com

--info-server

 

Displays the Spamassassin spam filter settings of the Plesk server.

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

# ./spamassassin --info-server

--help or -h

 

Displays help on the use of this utility.

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

# ./spamassassin --help

Options

Option

Parameter

Description

Example

-status

true|false

Enables/Disables the Spamassassin filter.

To enable the Spamassassin filter on the mail account JDoe@example.com:

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

To disable the Spamassassin filter on the Plesk server:

./spamassassin --update-server -status false

-server-conf

true|false

Enables/Disables using server- wide antispam filter settings.

Deprecated since Plesk 8.1.

To enable using server-wide Spamassassin filter settings:

# ./spamassassin --update-server -server-conf true

-personal-conf

true|false

Enables/Disables using mail name-specific (rather than server- wide) antispam filter settings for a mail account.

To enable using mail name-specific Spamassassin filter settings on JDoe@example.com:

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

-hits

<number>

Specifies the minimum score for a mail message to be marked as spam.

To set the minimum score for marking mail messages as spam for JDoe@example.com to 3:

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

-max-proc

<1|2|3|4|5>

Specifies the maximum number of simultaneously running spamd processes on server.

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/Disables subject lines automatic modification for messages marked as spam.

To enable subject lines automatic modification for spam messages and to specify the text to be inserted in the beginning of the subject line to "***SPAM*** Score: _SCORE_ :" on JDoe@example.com:

# ./spamassassin -u JDoe@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 for messages marked as spam.

Type _SCORE_ to include the message's spam score in the message subject line.

-reject-spam

true|false

Enables/Disables deleting spam messages automatically.

To enable deleting spam messages automatically for JDoe@example.com:

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

-ignorelist

<add|del>:<pattern1[,pattern2]

Add/Deletes mail patterns to/from ignore list.

Used with --update-server only.

Deprecated since Plesk 8.1.

To add email patterns jane*@example.com and ???Doe@*.example.net to the Spamassassin's black list of JDoe@example.com:

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

-blacklist

<add|del|enable|disable>:<pattern1>[,<pattern2>,[…]]

Adds/Deletes mail patterns to/from the Spamassassin black list; enables/disables email patterns in the Spamassassin black list.

 

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

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

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

-whitelist

<add|del|enable|disable>:<pattern1>[,<pattern2>,[…]]

Adds email patterns to or deletes them from the Spamassassin white list. Enables or disables email patterns in the Spamassassin white list.

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

To add e-mail patterns *jane@example.com to the Spamassassin's white list of the server:

# ./spamassassin --update-server -whitelist add:*jane@example.com

* 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.