Review your favorite Linux distribution.
Go Back > Forums > Linux Forums > Linux - Server
User Name
Linux - Server This forum is for the discussion of Linux Software used in a server related context.


  Search this Thread
Old 02-01-2008, 11:48 AM   #1
Senior Member
Registered: May 2004
Location: Orlando, FL
Distribution: Arch
Posts: 2,905

Rep: Reputation: 75
Adjusting Spamassassin To Catch Spam

I have spamassassin setup on my email server (Postfix) and it marks 1/2 of my SPAM as ***SPAM*** however not most or all. I undertstand that tagging every legitimate piece of SPAM is not realistic however I would hope it would do a better job. Right now my email server houses only one mailbox.

Here is an example of a SPAM message that was not labeled SPAM due to scoring.

Return-Path: <>
Received: by (Postfix, from userid 5001)
id 078B716B0248; Fri, 1 Feb 2008 09:34:02 -0500 (EST)
X-Spam-Checker-Version: SpamAssassin 3.1.7-deb (2006-10-05) on
X-Spam-Level: *
X-Spam-Status: No, score=1.9 required=2.0 tests=HTML_IMAGE_ONLY_12,
HTML_MESSAGE,HTML_SHORT_LINK_IMG_1 autolearn=no version=3.1.7-deb
Received: from mfuhji (unknown [])
by (Postfix) with SMTP id 7ADDA16B0248
for <>; Fri, 1 Feb 2008 09:33:53 -0500 (EST)
Message-ID: <000901c864df$7b596580$0100007f@dvxym>
From: "Brandon Allen" <>
To: <>
Subject: 0EM Software
Date: Fri, 01 Feb 2008 12:34:17 -0400
MIME-Version: 1.0
Content-Type: multipart/related;
Content-Transfer-Encoding: 7bit
X-Priority: 3 (Normal)
X-MSMail-Priority: Normal
X-Mailer: Microsoft Outlook Express 6.00.2900.2905
X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.2962

OK so you perhaps would like to see what my file looks like for SA, right? I don't have access to it now however is there anything you can recommend in the time being?

Last edited by carlosinfl; 02-01-2008 at 11:50 AM.
Old 02-01-2008, 12:03 PM   #2
Senior Member
Registered: Aug 2003
Location: UK
Distribution: Slackware
Posts: 3,217

Rep: Reputation: 295Reputation: 295Reputation: 295
Well a few spam mails do get through from time to time. I would recommend saving them into a separate mailbox/folder and running sa-learn on the folder when you have collected quite a few.
Old 02-01-2008, 12:11 PM   #3
LQ Guru
Registered: Aug 2003
Distribution: CentOS, OS X
Posts: 5,131

Rep: Reputation: Disabled
Yup, sa-learn is the tool. It takes a certain amount of learned messages before SpamAssassin starts working "efficiently"; I don't remember the estimate, but it was some hundred messages I think. So after you've collected and sa-learn'ed a thousand messages, you may expect it to catch most of the incoming spam.

Here's a script I use to "teach" SA on my university account:
echo "* Learning new mails *"
echo "received: \c"
sa-learn --showdots --nonspam --mbox mail/received
echo "spam_assassin: \c"
sa-learn --showdots --spam --mbox mail/spam_assassin
echo "important_stuff: \c"
sa-learn --showdots --spam --mbox mail/important_stuff
echo "* Ready *"
Ok, a bit of an overkill maybe, but handy. So when I log in, I check my mail, if there are any spams, move them to spam_assassin, and once a week or so check that spam_assassin doesn't contain any non-spam messages and run the above script. Works like a charm. I haven't used it for very long yet, so I'll keep teaching the thing, but eventually I'll probably make SA not to move the spam to spam_assassin, but to delete it directly - when it has learned enough, the probability of non-spam getting caught is small enough for me to have the thing work automatically.

So now my only trouble with spam is to check once a week or so that there are no non-spam messages in the spam directory, and run the script. For some time now it has meant just running the script

EDIT: and yeah - in the beginning every second spam seemed to get trough to my inbox, but nowadays I see them very rarely, if at all.

Last edited by b0uncer; 02-01-2008 at 12:13 PM.


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
Postfix, dovecot, spamassassin SPAM to a spam folder breitscott Linux - Server 30 02-17-2007 03:47 PM
spam/not spam folder in spamassassin depam Linux - Networking 2 11-29-2006 08:01 AM
Email and spam in different folders using spamassassin tensigh Linux - Software 3 08-11-2005 11:21 AM
Training SpamAssassin - where to get current spam chakkerz Linux - Software 1 04-21-2005 12:27 AM
spamassassin tags spam while procmail isn't running broxtor Linux - Software 1 10-13-2004 03:57 PM

All times are GMT -5. The time now is 02:07 PM.

Main Menu
Write for LQ is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration