-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
SA 3.0 cvs, sendmail, spamass-milter
I want use Bayes sitewide.
Users forward not detected spam messages to spam-non-catch folder using
MS outlook forward.
Some there messages contain few(!) noncatched spam.
Do anybody know script to call correctly sa-learn on mbox that restore
attached spam messages.
I tried to use http://jousset.org/pub/sa-postfix.en.html
I setup procmail for spam-non-catch:
~spam-non-catch/.procmail:
:0 c
| /usr/local/sbin/sa-wrapper.pl spam
/usr/local/sbin/sa-wrapper.pl:
#!/usr/bin/perl -w
use strict;
use MIME::Tools;
use MIME::Parser;
my $DEBUG = 1;
my $UNPACK_DIR = '/var/spool/spam-non-catch/mime';
my $SA_LEARN = '/usr/local/bin/sa-learn';
my @DOMAINS = qw/leaves.ru ms.leaves.ru/;
#my ($spamham, $sender) = @ARGV;
my $spamham="spam";
sub recurs
{
~ my $ent = shift;
~ if ($ent->head->mime_type eq 'message/rfc822') {
~ if ($DEBUG) {
~ open(OUT, "|$SA_LEARN -D --$spamham --single
|/tmp/spam.log.$$ 2>&1") or die "Cannot pipe
~ $SA_LEARN: $!";
~ } else {
~ open(OUT, "|$SA_LEARN --$spamham --single") or die "Cannot
pipe $SA_LEARN: $!";
~ }
~ $ent->bodyhandle->print(\*OUT);
~ close(OUT);
~ return;
~ }
~ my @parts = $ent->parts;
~ if (@parts) {
~ map { recurs($_) } @parts;
~ }
}
#my ($domain) = $sender =~ /\@(.*)$/;
#unless (grep { $_ eq $domain } @DOMAINS) {
# die "I don't recognize your domain !";
#}
if ($DEBUG) {
~ MIME::Tools->debugging(1);
~ open(STDERR, ">/tmp/spam_err.log");
}
my $parser = new MIME::Parser;
$parser->extract_nested_messages(0);
$parser->output_under($UNPACK_DIR);
my $entity;
eval {
~ $entity = $parser->parse(\*STDIN);
};
if ($@) {
~ die $@;
} else {
~ recurs($entity);
}
#$parser->filer->purge;
#rmdir $parser->output_dir;
- -------------------------------------------------------------
But log file generated by this script shows only one message proceed:
...
Learned from 1 message(s) (1 message(s) examined).
- --
Sergey Smirnov
hkp://wwwkeys.pgp.net
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.4 (GNU/Linux)
Comment: Using GnuPG with Thunderbird - http://enigmail.mozdev.org
iD8DBQFAohKUTW1qobfmhlsRAiaoAJ9EuOWk23a0LVRKnGJwnteebp3ibgCfWVW3
h74Asjx3l4s3jMhiPjLzOtQ=
=DdiE
-----END PGP SIGNATURE-----