On 10/30/06, itdelany <[EMAIL PROTECTED]> wrote:
 Hi

 I am running a Postfix mail server set up with flurdis guide using
SpamAssassin as well with a Bayesian Filter.

 At SpamAssasin site said this:

 If you want to set up site-wide use of Bayesian classification, you should
set up a way for your users to send in misclassified mail to be "learned"
from. If you create mailboxes for false positives and false negatives, you
can then run a cron job intermittently to learn all the mails in that
mailbox as spam (or non-spam).

 So i said to my users to send unwanted email to [EMAIL PROTECTED] and
[EMAIL PROTECTED],

currently i reached the number necessary to run the sa-learn filter and i
saw this (at spamassasin site too):

 For MUAs (Like Netscape/Mozilla) that do a good job with keeping original
headers intact, (almost) all you need to do is forward the email to the
feedback account and strip off the header added by the forward.

 - Has someone gone throught this situation before? What did you do to clean
the email from forward headers? Can you please give me the details for
stripping forward headers added by Mozilla Thunderbird?

 Is this the only thing to do with Outlook based clients ? : Create a *new*
mail message in Outlook/Express. Resize the windows so that you can see both
your new message as well as the main O/OE window. Select the messages you
want to send as Spam or Ham (probably not both in the same message) and drag
them "into" the new message. This will send all the messages as attachments
to the main email.


hey,

There is a script which can do this. Create a user suppose
[EMAIL PROTECTED] and all the users will forward spam mails to
this address . Please note you need to choose "forward as attachment"
while forwarding the mail to this account ([EMAIL PROTECTED]

I am directly posting the mail from the person who helped me configuring this.

1) user forwards spam message AS ATTACHMENT to a pre-defined
email address

I tell my users to forward as attachment to [EMAIL PROTECTED]

2) postfix pipes emails to this address to the modified
script via local alias

I am also using virtual users.  You have to make sure that postfix knows
how to handle local aliases.  From my main.cf:

alias_maps = hash:/etc/aliases

...pointing to the local aliases file.  Then within that file, set up a
local alias to pipe all input to the script.  From my /etc/aliases:

spam-bayes:     "| /etc/scripts/strip_attached_messages.pl"

... Be sure to run the command 'newaliases' after updating the aliases
file.  Then you use virtual_alias_maps to set the
"[EMAIL PROTECTED]" address to forward to the alias you set up.  I
use MySQL for my virtual_alias_maps, but if you use a file it would have
something like:

[EMAIL PROTECTED]         spam-bayes

That will forward all emails sent to [EMAIL PROTECTED] to the
spam-bayes alias, which will in turn pipe them into your script.

3) the script strips out all attachments defined as content-type:
message/*


Cron isn't necessary if you have the alias set up.

5) a separate cron script then runs on a schedule to pipe all
messages in /tmp/spam into sa-learn and delete them afterwards

Need to setup the crontab to call this script

My cron script:
------------------------------------
#!/bin/sh

/usr/local/bin/sa-learn --spam --username=vscan /tmp/spam/
/bin/rm /tmp/spam/*
------------------------------------

--Username=vscan because I am using a single bayes database for all
mail, rather than individual bayes db's for each user.  This method
wouldn't work for individual bayes setups.  My crontab line:

53      1       *       *       *       root
/etc/scripts/train-bayes.sh

... To run it once per day at 1:53 am.  I get a nice email every morning
to root which says:

Learned tokens from 102 message(s) (102 message(s) examined)



The only thing to configure in the script is the path where you want the
attached messages stored until your sa-learn script runs.  I save mine
to /tmp/spam/, and that's where the train-bayes.sh script looks for
them.

Hope this helps.  It has been working very well for me so far.





the Script


_________________________

#!/usr/bin/perl

use strict;
use warnings;

my @message = <STDIN>;
my $path = "/tmp/spam/";

use Mail::SpamAssassin::Message;
use Data::UUID;

my $msg = Mail::SpamAssassin::Message->new(
   {
     'message' => [EMAIL PROTECTED],
   }
) || die "Message error?";

foreach my $p ($msg->find_parts(qr/^message\b/i, 0)) {
   eval {
          no warnings ;
          my $type = $p->{'type'};
          my $ug = new Data::UUID;
          my $uuid1 = $ug->create_str();
          my $attachname = $path . $uuid1 . ".eml";
          open OUT, ">", "$attachname" || die "Can't write file
$attachname:$!";
          binmode OUT;
          print OUT $p->decode();
   };
}


Regards

Ankush Grover

Reply via email to