summary: The SpamAssassin spam filter identifies spam messages among emails sent to mailboxes hosted on your Plesk server.

In this topic you will learn how to enable SpamAssassin on the server, and also how to configure SpamAssassin so that it better able to catch spam.

To achieve the desired level of spam protection, Plesk lets you configure a number of SpamAssassin settings, namely:

  • Spam filter sensitivity.

    To identify spam messages, SpamAssassin performs a number of different tests on contents and subject line of each message. As a result, each message scores a number of points. The higher the number, the more likely a message is spam. For example, a message containing the text string “BUY VIAGRA AT LOW PRICE!!!” in the Subject line and the message body scores 8.3 points. By default, the filter sensitivity is set so that all messages that score 7 or more points are classified as spam. If your users still receive spam messages with the default sensitivity, increase it by setting a lesser value, for example, 6. If SpamAssassin marks valid messages as spam, decrease the sensitivity by setting a higher value.

  • Spam marks

    At the server level, you cannot set the server-wide spam filter to automatically delete spam: you can do it only on a per-mailbox basis. So, for the server-wide policy, you can choose only marking messages as spam: X-Spam-Flag: YES and X-Spam-Status: Yes headers are added to the message source by default. If you want, the spam filter will additionally include a specific text string to the beginning of the messages’ subject line (by default, this string is *****SPAM*****).

    Though you cannot configure SpamAssassin to delete all spam messages, you can let each mailbox owner configure their own spam protection settings. This includes, for example, setting their spam filters to automatically delete messages marked by SpamAssassin, or setting up their personal black and white lists. For details on adjusting spam filtering settings for a specific mailbox, refer to the section Protecting from Spam.

  • Maximum size of messages to check

    Analyzing a huge number of emails can heavily increase the load on your server. To avoid this, you can set the maximum size of the message that the spam filter will test.

  • Number of SpamAssassin processes

    Another way to limit the server loading by SpamAssassin is defining the maximum number of SpamAssassin processes (on Linux) or threads (on Windows) running simultaneously on the server. In Plesk for Linux, the maximum number of SpamAssassin processes you can configure via the Plesk GUI is 32. If you require more SpamAssassin processes to run simultaneously, add the following lines to the panel.ini file:

[mail]
spamAssassin.maxChildrenLimit = 80

where the numeric value indicates the maximum number of SpamAssassin processes that can be configured in the Plesk GUI.

  • (Plesk for Windows) Trusted languages and locales

    You can define the language characteristics of mail that should always pass the filter by specifying trusted languages and locales. Letters written in the specified languages and with the defined character sets will not be marked as spam.

  • Black and white lists

    SpamAssassin lets you include certain senders into its black and white lists:

    • If you want the emails from specific domains or individual senders to be always treated as spam, add the respective entries to the spam filter’s black list. SpamAssassin will add the USER_IN_BLACKLIST mark to the header of each email from the specified addresses to guarantee that this email will be processed as spam. As a result, the email will be marked as spam, deleted, or placed to the Spam folder, depending on the SpamAssassin settings specified for the whole server and for a particular mailbox.
    • If you want to be sure that you and your users will not miss email from specific senders, add email addresses or entire domains to the spam filter’s white list.

    Learn how to configure black and white lists at the Configuring Black and White Lists section.

Note: Plesk provides only basic SpamAssassin functionality. If you want to create complex antispam rules, edit SpamAssassin configuration files. For more information on advanced SpamAssassin configuration, refer to the Advanced Administration Guide, Spam Protection for Linux or Windows and the SpamAssassin documentation.

Switching on SpamAssassin

To switch on SpamAssassin:

  1. Go to Tools & Settings > Spam Filter (in the Mail group).

  2. Select the option Switch on server-wide SpamAssassin spam filtering.

  3. To let your users set their own spam filtering preferences on a per-mailbox basis, select the option Apply individual settings to spam filtering.

  4. (Plesk for Linux) Define how much resources SpamAssassin can consume in the “Maximum processes” field. The more resources you allocate, the faster SpamAssassin will process mail. However, if you allocate too much resources, it may impact other services. We recommend that you use the default value.

  5. Adjust the spam filter’s sensitivity by typing the desired value in the field “Required score”.

    By default, the filter sensitivity is set so that all messages that score 7 or more points are classified as spam. If your users still receive spam messages with the default sensitivity, increase it by setting a lesser value, for example, 6. If SpamAssassin marks valid messages as spam, decrease the sensitivity by setting a higher value.

  6. Define the maximum size of messages that SpamAssassin will process. To do so:

  7. Specify how to mark messages recognized as spam in the field “Spam tag”. If you do not want the spam filter to modify message subject, leave this box blank. If you want to include into the subject line the number of points that messages score, type _SCORE_ in this box.

  8. (Plesk for Windows) Specify trusted languages and locales using the lists Trusted languages and Trusted locales.

  9. Click OK.

(Plesk for Linux) Defining the Maximum Mail Size for SpamAssassin

To decrease the load on your server caused by SpamAssassin, you can limit the maximum size of emails that SpamAssassin should analyze. All messages exceeding this size will be delivered to their recipients without checking.

To define the maximum size of messages that SpamAssassin will process:

  1. Open for editing the configuration file /etc/psa/psa.conf

  2. Specify the desired value in bytes for the parameter SA_MAX_MAIL_SIZE.

    By default, the maximum email size is 256000 bytes. We recommend that you limit the maximum mail size to 150 - 250 Kbytes, which is usual for mail messages in HTML format with images. The size of the mail is considered critical for filter and server overload if it exceeds 500 Kbytes, which is usual for mail messages containing attachments.

Configuring Black and White Lists

To add entries to the black or white list:

  1. Go to the Black List or the White List tab of the Tools & Settings > Spam Filter page.

  2. Click Add Addresses.

  3. Provide the list of entries you want to add to the list.

    Separate addresses with a comma, a colon, or a white space. You can use an asterisk (*) as a substitute for a number of letters, and question mark (?) as a substitute for a single letter. For example: address@spammers.net, user?@spammers.net, *@spammers.net. Specifying *@spammers.net will block the entire mail domain spammers.net. If you use a Windows-based server, also specify what to do with messages coming from the specified addresses.

  4. Click OK.

To remove entries from the black or white list:

Select the entries on the corresponding tab and click Remove.