MailScanner+SpamAssassin SQL User Preferences
Jones, Chris
chris.jones at ATMOSENERGY.COM
Thu Sep 30 13:34:01 IST 2004
Do you have to put you CustomFunction in the Config.pm to get access to
the MailScanner::Log? Or can you put the function in the
MailScanner/MailScanner/CustomFunctions ?
-----Original Message-----
From: MailScanner mailing list [mailto:MAILSCANNER at JISCMAIL.AC.UK] On
Behalf Of SatyaDev Sharma
Sent: Thursday, September 30, 2004 1:18 AM
To: MAILSCANNER at JISCMAIL.AC.UK
Subject: Re: MailScanner+SpamAssassin SQL User Preferences
Hello Edmond.
few points are there.....
if ur users are local then spac/spamd works well but if its a mail
router then u have to do some more titbits....!
u need to create a perl lib file for it, that have functions about sql
pref.
1. create a file like sql_pref.pm
2. include it in CustomConfig.pm
3. define function names in MailScanner.conf
4. restart MS.
i m including a function below to get well how it works.
###################### Spam Score
#######################################
sub InitGet_Spam_Score
{
my $dbh = DBI->connect($dsn, $username, $password);
my $sth = $dbh->prepare("SELECT * FROM spam_setting ORDER BY
$to_mail");
$sth->execute();
my $count = 0;
while (my $ref = $sth->fetchrow_hashref())
{
$list_hash_score{lc($ref->{'to_mail'})} = $ref->{'spam_score'};
MailScanner::Log::InfoLog("SPAM score %s ->
%s",$ref->{'to_mail'},$ref->{'spam_score'});
$count++;
}
$dbh->disconnect;
}
sub Get_Spam_Score
{
my ($message) = @_;
return 0 unless $message; # Sanity check the input
my($from, @to, $to);
$from = $message->{from};
@to = @{$message->{to}};
foreach $to (@to)
{
return $list_hash_score{lc($to)} if $list_hash_score{lc($to)};
}
return $list_hash_score{(global_spam_setting)};
}
sub EndGet_Spam_Score
{
;
}
######################
- Satya !
----- Original Message -----
From: "Edmond Yeoh" <shearmagic at gmail.com>
To: "SatyaDev Sharma" <satya at bainsdigital.com>
Cc: <mailscanner at jiscmail.ac.uk>
Sent: Thursday, September 30, 2004 11:19 AM
Subject: Re: MailScanner+SpamAssassin SQL User Preferences
> Hi Satya,
>
> How did you get it to work? My users are not on the local server and
> the mail is routed to other email servers based on LDAP Routing. Are
> you using the spamc / spamd daemons? I saw a post by you on Feb 20th
> stating you were having the same problem. What did you do to solve
> this issue? I am also not getting any error in log but its not reading
> from mysql table :(
>
> Thanks for your help.
>
> Regards,
> Edmond Yeoh
>
> On Thu, 30 Sep 2004 10:57:54 +0530, SatyaDev Sharma
> <satya at bainsdigital.com> wrote:
> > Hello,
> > I m using per user sql based spam filtering .... it should work
> > nicely ....where u r missing can u tell me in detail so i can
> > describe !!
> >
> > -Satya
> >
> >
> >
> > ----- Original Message -----
> > From: "Edmond Yeoh" <shearmagic at GMAIL.COM>
> > To: <MAILSCANNER at JISCMAIL.AC.UK>
> > Sent: Sunday, September 26, 2004 12:56 PM
> > Subject: MailScanner+SpamAssassin SQL User Preferences
> >
> > > Hi everyone,
> > >
> > > I would like to ask if anyone have managed to load user-based spam
> > > rules from a mysql database.
> > >
> > > I have did the following in the configuration file, but it does
> > > not
work.
> > >
> > > user_scores_dsn DBI:mysql:spam:localhost
> > > user_scores_sql_username spam
> > > user_scores_sql_password pass
> > > user_scores_sql_table userpref
> > >
> > > From my research so far, I found out that MailScanner's use of
> > > spamassassin does not use the spamc / spamd but calls the perl
> > > function library directly.
> > >
> > > Can anyone provide some hints on what can be done to load the user
> > > spam rules from a database? Any kind of help / comments would be
> > > greatly appreciated. Thanks!
> > >
> > > Edmond
> > > -------------------------------------------------------------
> > > Scanned for viruses, spam and dangerous content by DefenderMX
> > > -------------------------------------------------------------
>
------------------------ MailScanner list ------------------------ To
unsubscribe, email jiscmail at jiscmail.ac.uk with the words: 'leave
mailscanner' in the body of the email. Before posting, read the MAQ
(http://www.mailscanner.biz/maq/) and the archives
(http://www.jiscmail.ac.uk/lists/mailscanner.html).
------------------------ MailScanner list ------------------------
To unsubscribe, email jiscmail at jiscmail.ac.uk with the words:
'leave mailscanner' in the body of the email.
Before posting, read the MAQ (http://www.mailscanner.biz/maq/) and
the archives (http://www.jiscmail.ac.uk/lists/mailscanner.html).
More information about the MailScanner
mailing list