Ive had a mail server for a long time. Ive always used the built in Spamassasin that Thunderbird uses. I recently got a blackberry and was receiving the spam even though Thunderbird was successfully filtering the spam to the Junk folder. This is because the MTA, Dovecot in my instance, was transferring the mail to Thunderbird and the Blackberry at the same time leaving the mail unfiltered on the Blackberry. To resolve this I required server side spam labeling and filtering. First the mails needed to be labeled as spam. Spamassasin does this nicely. Install Spamassasin using:

sudo apt-get install spamassassin spamass-milter

Then in your sendmail.mc config file add:

 # spamassassin settings INPUT_MAIL_FILTER(`spamassassin',`S=local:/var/run/spamass/spamass.sock, F=,T=S:4m;R:4m;E:10m')dnl

Now your going to configure Spamassassin to label spam mails as such. Open the config file with:

sudo nano /etc/mail/spamassassin/local.cf

Remove the pound # sign to uncomment:

rewrite_header Subject *****SPAM***** required_score 5.0 use_bayes 1 bayes_auto_learn 1

Make sure you build the sendmail.cf file. Restart sendmail. Now you have to train Spamassassin. In Thunderbird you have to sort all known spam to a particular folder. Place 200 or so spam messages in the Junk folder completely without any good emails. Then run:

sa-learn --showdots --mbox --spam mail/Junk

 The above snipped is run from your users root directory. You can cd to the mail directory and run:

sa-learn --showdots --mbox --spam Junk

Then place known good emails in a particular directory and run:

sa-learn --showdots --mbox --ham mail/temp

Run this every once in a while to increase the accuracy of your spam filter. I have excellent spam detection after only a couple of days of training.