How to configure Spam Assassin's Bayesian filter? Print

  • 43

A slightly more advanced method of handling automatic spam detection is to use "SpamAssassin" which can somehow "learn" from the way you sort your email to detect spam by itself. You have a "spam" folder (only for IMAP and Webmail access) in your mailbox where messages detected as potentially unwanted are filed. If there are legitimate emails in there, you just remove them from that folder; and vice versa: if there are unwanted emails in your inbox, you just put them in the spam folder.

This method can be very effective because it will be completely personalized to you according to your own criteria and received e-mails. However, it has the disadvantage of being a bit slow to become effective (it takes several hundred emails to start "getting the hang of it") and its configuration can seem complex to the uninformed user. In order to free you at least from this last point, we are going to explain you here how to set it up on your account, for the rest it will only be a question of patience and rigor...

Step 1: Login

Log in to your Control Panel

      ;

Step 2: Activate the SpamBox

Follow the instructions in this other topic to activate the SpamBox and disable Auto-Delete in your account: How do I activate the Spam Box?

SpamAssassin - Activation de la SpamBox

This will create a "spam" folder in your mailbox and automatically deposit emails considered as spam according to the score you set.

Step 3: Creating the analysis tasks

You will need to create two cron jobs so that SpamAssassin can scan the content of your mailbox.
Start with the task that will identify spam: In your Control Panel, scroll down to the "Advanced" tab, then select "Cron Tasks":

SpamAssassin - Création d'une tâche cron

Scroll down to "Common Settings" in the cron interface and select "Once a day ... ", then enter an hour and minutes in the day when you don't use the computer much or at all, e.g. "3:36" in the morning. Leave "*" on "Day", "Month", and "Day"; then type the following command in the "Command" slot (you can "copy and paste"):

/usr/local/cpanel/3rdparty/bin/sa-learn-p ~/.spamassassin/user_prefs --spam ~/mail/*/*/.spam/{cur,new}

You get something like this:

SpamAssassin - Création d'une tâche cron

Click on "Add a new Cron task". Your spam analysis task is created.

Now, to create the legitimate email scanning task do it again: this time selecting a time 30 minutes after the first one, in our example it would be 4:06 am. Then enter the following command in the "Command" location:

/usr/local/cpanel/3rdparty/bin/sa-learn-p ~/.spamassassin/user_prefs --ham ~/mail/*/*/{cur,new}

You get something like this:

SpamAssassin - Création d'une tâche cron

Click on "Add a new Cron task". Your legitimate email scanning task is created.

Your Cron task list should now contain at least these two entries that you have just added:

SpamAssassin - Création d'une tâche cron

Step 4: Usage

Now you only have to do two things:

      1. Monitor the contents of your spam
      2. folder to move any legitimate messages to another folder in your mailbox;
      3. Place in your spam
      folder any e-mail that you consider to be spam that was not automatically placed in this folder when it was received.

Be patient: as mentioned above, it takes several hundred messages before the automatic sorting starts to be effective. The more rigorous you are in your sorting, the better the automated result will be.



Step 5 (optional): Deactivation

If you want to deactivate this feature, you will just have to delete the two Cron

    tasks created and eventually deactivate the SpamBox if you don't want to have a "spam" folder in your mailbox anymore.

 


Was this answer helpful?

Back