Web Hosting Forum | Lunarpages


*
Welcome, Guest. Please login or register.
Did you miss your activation email?



Login with username, password and session length
April 24, 2014, 10:52:36 PM

Pages: 1 [2] 3 4 ... 19   Go Down
  Print  
Author Topic: How-to: Train SpamAssassin - Updated April 27, 2010  (Read 130109 times)
w98
Galactic Royalty
*****
Offline Offline

Posts: 441



WWW
« Reply #15 on: April 16, 2004, 10:29:34 AM »

edited the how-to today to reflect the fact that everyone's user_prefs file is just full of comments and blank lines, and so set my instructions to replace the entire contents of their file with mine if their file is like that.

any line in user_prefs that starts with a '#' is just a comment marker - so the software will ignore everything after the '#' character if that's the first character it sees on a line.
Logged

pheared
Intergalactic Superstar
*****
Offline Offline

Posts: 194



WWW
« Reply #16 on: September 11, 2004, 09:29:30 AM »

Here is my modified version.  It processes the "miss" and "ham" mailboxes of all of my users.  (I remember why I hate perl now. Razz )
Code:

#!/usr/bin/perl

my $user = "username";
my $domain = "domainname";
my $salearn = "/usr/bin/sa-learn";
my $basepath = "/home/$user";
my $configfile = "$basepath/.spamassassin/user_prefs";
my $files = `find $basepath/mail/$domain/ -type f -name miss`;
my $hamfiles = `find $basepath/mail/$domain/ -type f -name ham`;
$|;

print "Content-type: text/plain\n\n";

print "Learning SPAM:\n";
print $files;
$files =~ s/\n/ /g;
print `$salearn -p $configfile --mbox --spam $files`;
print "\n\n";

print "Learning HAM:\n";
print $hamfiles;
$hamfiles =~ s/\n/ /g;
print `$salearn -p $configfile --mbox --ham $hamfiles`;
print "\n\n";

foreach $file (split(/ /, $files . $hamfiles)) {
        print "Cleaning out: $file\n";
        open (SPAM, "> $file");
        print SPAM 'From MAILER-DAEMON Sat Sep 11 09:53:05 2004
Date: 11 Sep 2004 09:53:05 -0700
From: Mail System Internal Data <MAILER-DAEMON@taurus.lunarpages.com>
Subject: DON\'T DELETE THIS MESSAGE -- FOLDER INTERNAL DATA
Message-ID: <1094921585@taurus.lunarpages.com>
X-IMAP: 1094921532 0000000001
Status: RO

This text is part of the internal format of your mail folder, and is not
a real message.  It is created automatically by the mail system software.
If deleted, important folder data will be lost, and it will be re-created
with the data reset to initial values.

';
        close SPAM;
}
exit;

Logged

parish2
Spaceship Navigator
*****
Offline Offline

Posts: 93


« Reply #17 on: September 14, 2004, 10:39:32 AM »

I'm at the very beginning of the instructions.  I've enabled SPAM Assassin and Spam Box in my control panel.  When I go to Squirrel Mail, I see lots of mailboxes, but only one of them has a /spam extension.   It looks like Spam Box has only been enabled for one of the mailboxes (which happens to be mine... hmm.) I clicked to subscribe to this mailbox, and it moved into my folder list.  But I'm wondering about how to filter the other mailboxes on my domain for spam.
Logged
pheared
Intergalactic Superstar
*****
Offline Offline

Posts: 194



WWW
« Reply #18 on: September 14, 2004, 10:47:24 AM »

The spam boxes are created as needed.  The accounts haven't received spam yet.
Logged

parish2
Spaceship Navigator
*****
Offline Offline

Posts: 93


« Reply #19 on: September 14, 2004, 10:24:28 PM »

So this new IMAP folder I've got in my Outlook - I just want to be sure I understand what it is.  It seems to have all the incoming mail for all the mailboxes at my domain.  Do I assume that as long as they show up in this inbox folder, the various intended recipients will still be able to get them using their Outlook?
Logged
TranzNDance
Princess of Naboo
Berserker Poster
*****
Offline Offline

Posts: 11619



WWW
« Reply #20 on: September 14, 2004, 10:33:07 PM »

Oh, wow. I didn't know that setting the default account with IMAP would give it access to all the other accounts. Shock.!!

Anyway, to answer your question, parish2, as long as you do not delete the messages and purge, the recipients will have access to their mail.
Logged

Grr..!! Luff Ya Grr..!! Luff Ya Grr..!! Luff Ya
parish2
Spaceship Navigator
*****
Offline Offline

Posts: 93


« Reply #21 on: September 14, 2004, 11:02:50 PM »

OK, everything seems to be working.  I moved a bunch of spam into myspam.  They still show up in the IMAP inbox with a strikeout through them.  I ran the cgi, and that emptied the myspam folder, but what about the spam (with the strikeout) that is in the inbox?  Do I have to manually delete these?
Logged
TranzNDance
Princess of Naboo
Berserker Poster
*****
Offline Offline

Posts: 11619



WWW
« Reply #22 on: September 15, 2004, 04:23:48 AM »

You need to purge, which is like emptying the trash. It's under the Edit menu.
Logged

Grr..!! Luff Ya Grr..!! Luff Ya Grr..!! Luff Ya
parish2
Spaceship Navigator
*****
Offline Offline

Posts: 93


« Reply #23 on: September 15, 2004, 04:30:28 AM »

Excellent! Thank you.    Thumbs Up
Logged
parish2
Spaceship Navigator
*****
Offline Offline

Posts: 93


« Reply #24 on: September 17, 2004, 06:26:42 AM »

When subscribing to spam mailboxes, per these instructions:

<<
- on the right side, you should see mailboxes for each Email accounts on your domain, like this: mydomain.com /joesmith/spam (assuming you have a valid mailbox for joesmith@mydomain.com)
- click on a spam box to subscribe to, and click the 'subscribe' button at the bottom of the list
>>

What about the mailbox simply called "spam" with no user mailbox prefix?  Do I subscribe to this as well?
Logged
parish2
Spaceship Navigator
*****
Offline Offline

Posts: 93


« Reply #25 on: September 18, 2004, 10:59:17 AM »

Does the spam that is correctly identified and which Spam Assassin puts in the spam folder get purged automatically eventually, or should I be doing this?
Logged
TranzNDance
Princess of Naboo
Berserker Poster
*****
Offline Offline

Posts: 11619



WWW
« Reply #26 on: September 18, 2004, 11:17:27 AM »

No, it does not automatically get purged.
Logged

Grr..!! Luff Ya Grr..!! Luff Ya Grr..!! Luff Ya
parish2
Spaceship Navigator
*****
Offline Offline

Posts: 93


« Reply #27 on: September 22, 2004, 08:41:11 AM »

So are there any scripts that empty spam folders, or does the spam really just buld up until someone empties it or it bursts?  Confused
Logged
pheared
Intergalactic Superstar
*****
Offline Offline

Posts: 194



WWW
« Reply #28 on: September 22, 2004, 11:03:37 AM »

I've written one that goes through and finds all of my user's spam folders, marking messages older than X days for deletion and expunging them, all through IMAP.
Logged

parish2
Spaceship Navigator
*****
Offline Offline

Posts: 93


« Reply #29 on: September 22, 2004, 04:49:42 PM »

Sounds very useful.  Is it something you can share?  (And instruct me how to run?)
Logged
Pages: 1 [2] 3 4 ... 19   Go Up
  Print  
 
Jump to: