Hi Mark
Try using a wrapper script named sa-wrapper.pl.
if you are using postfix as an MTA then it will work like this,
lets say your spam and no spam email addresses are [EMAIL PROTECTED] and [EMAIL PROTECTED] The xyz.com should be the mydestination of the server on
which spamassassin is running.
In the aliases file put entry like this spam: [EMAIL PROTECTED] nospam: [EMAIL PROTECTED]
Then in transport file specify a transport for these spam.spam sa-spam: ham.ham sa-ham:
Then in the master.cf make the following addition (this will feed the coming mail incoming mail as input to the sa-wrapper.pl )
sa-spam unix - n n - - pipe user=mail:mail argv=/usr/local/bin/sa-wrapper.pl spam ${sender}
sa-ham unix - n n - - pipe user=mail:mail argv=/usr/local/bin/sa-wrapper.pl ham ${sender}
If you are using Sendmail as an MTA
Again the domain name should be local to the server. In the aliases file put an entry like this
spam: "|/usr/local/bin/sa-wrapper.pl spam [EMAIL PROTECTED]" nospam: "|/usr/local/bin/sa-wrapper.pl nospam [EMAIL PROTECTED]"
At the sa-wrapper.pl there is an array named DOMAINS in which you will have to specify the domains. Sa-wrapper will learn only from those feedbacks whose domains are listed in this array. Frankly the entry in the aliases file for sendmail is just a workaround to make the script work sendmail because i didnt knew any best way to get the sender's email address in the aliases file. So if you know this just fix this and also let me know.
for your reference I am attaching a sa-wrapper.pl file.
This works fine for my servers and users are able to send their feedback to spam and nospam ids, hope this works for you as well.
Rakesh
Mark Nicolas wrote:
Hi,
I want that my users can send spam to mail addresses, for example [EMAIL PROTECTED] and [EMAIL PROTECTED]
so far I written a shell script and it will executet every day.
here it is:
<cut>
#!/bin/sh
sa-learn --mbox --spam /var/mail/spam > /dev/null
sa-learn --rebuild --mbox --ham /var/mail/nospam > /dev/null
/var/mail/spam
/var/mail/nospam
</cut>
----------------------------------------------------------
Netcore seeks Explorers, Inventors, Builders and Marketers http://www.emergic.org/nc-opps.html
----------------------------------------------------------
#!/usr/bin/perl -w # # sa-wrapper.pl # # SpamAssassin sa-learn wrapper # (c) Alexandre Jousset, 2004 # This script is GPL'd # # Time-stamp: <10 January 2004, 13:31 home> # v1.0
use strict;
use MIME::Parser;
my $DEBUG = 1;
my $UNPACK_DIR = '/var/spool/temp';
my $SA_LEARN = '/usr/bin/sa-learn';
my @DOMAINS = qw/yourdomain.com/;
sub recurs
{
my $ent = shift;
if ($ent->head->mime_type eq 'message/rfc822') {
$ent->bodyhandle->print(\*OUT);
return;
}
my @parts = $ent->parts;
if (@parts) {
map { recurs($_) } @parts;
}
}
my ($spamham, $sender) = (shift, shift);
my ($domain) = $sender =~ /\@(.*)$/;
unless (grep { $_ eq $domain } @DOMAINS) {
die "I don't recognize your domain !";
}
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 {
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: $!";
}
# open(OUT, ">/tmp/spam.log");
recurs($entity);
}
$parser->filer->purge;
