SpamAssassin Continued

Your ads will be inserted here by

Easy Plugin for AdSense.

Please go to the plugin admin page to
Paste your ad code OR
Suppress this ad slot.

We previously looked at basic SpamAssassin configuration in this previous article. We are now going to be looking into further advanced testing and configuration of SpamAssassin.

Testing SpamAssassin with GTUBE

Aside from adding keywords used to mark an email as spam which you can find out how to do here, you can also use a string called GTUBE (Generic Test for Unsolicited Bulk Email). If working correctly, SpamAssassin automatically gives it an antispam score of 1000.

Add the following string to the body of the email without line breaks or spaces:

The headers of the email with GTUBE in the body:

AutoDelete in cPanel

Emails set to be AutoDeleted at a certain threshold are not actually a SpamAssassin setting (SpamAssassin by itself never deletes a message marked as spam) but cPanel instead creates an Account Level Filter to handle this. To view this filter, click Account Level Filtering in cPanel. You can see “Generated SpamAssassin Discard Rule”. Clicking Edit will show the rule set.

The number of plus (+) symbols (5 above) is the score set to auto-delete. The action is to discard the message. This can be fine tuned to redirect to a different email address (for instance, spam@domain.com), fail with a specific message, deliver to a folder and a few others.

Your ads will be inserted here by

Easy Plugin for AdSense.

Please go to the plugin admin page to
Paste your ad code OR
Suppress this ad slot.

This is the exim mainlog for emails deleted this way. Note: A bounceback or message is not sent back to the original spam source by default.

Deleted at SMTP Time

If you are the administrator of a cPanel server running Exim, you can optionally have SpamAssassin reject your emails at SMTP time. The score can  be modified under Service Configuration in WHM >> Exim Configuration Manager. Emails will be deleted and a message bounced back to the original sender.

Exim mainlog:

Return email:

Advanced Configuration

The files for SpamAssassin can be found in the user’s home folder in the hidden directory “.spamassassin” (e.g. /home/user/.spamassassin). You can further define the tests to perform in this specific file. For instance, you can even define to only receive emails from certain languages. There’s more information on how to set this up here.

Testing Configuration

Errors in the user_prefs file may cause SpamAssassin to not mark emails as spam so care must be taken when working in the configuration file to prevent issues. The following command tests the spamassassin configuration file for syntax errors:

However, running the command above for the root user tests the global configuration file. This command can also be ran as the user to test the local user_prefs file for syntax errors. This can be performed while in jailshell for the user or by running as root with sudo (replacing cpuser as the cPanel user):

If nothing is returned when you run the command, the syntax for the file is correct.

Leave a Reply

Your email address will not be published. Required fields are marked *

Time limit is exhausted. Please reload CAPTCHA.