Mail-Decency
view release on metacpan or search on metacpan
lib/Mail/Decency/ContentFilter/CRM114.pm view on Meta::CPAN
# content filter out, cause they use their own scale)
# the following translated any crm114 score equal or
# bigger then 1 to 100, any score between 1 and -2 to
# internal score of 0 and anything below
weight_translate:
1: 100
-2: 0
-3: -100
=head2 INSTALL CRM114
This is a very simplified installation. For detailed information
and more in-depth information refer to google.
Assuming you don't want an per-user but a global css database...
First of get crm. In a debian system that would be:
aptitude install crm114
(for source compilation or other distries refer to google)
Then make some crm114 directory. This might get large (depending
on the amount of trained mails)
mkdir /var/spool/crm114
cd /var/spool/crm114
Now copy the basic configuration files there
cp /usr/share/crm114/mailfilter.cf .
Create empty priority and whitelist files
touch rewrites.mfp priolist.mfp whitelist.mfp blacklist.mfp
Create empty css files for spam and ham
cssutil -b -r spam.css
cssutil -b -r nonspam.css
Make some modifications in the config file mailfilter.cf
(again: google for info about that matter)
:spw: /mypassword/
:add_verbose_stats: /no/
:add_extra_stuff: /no/
:rewrites_enabled: /no/
:spam_flag_subject_string: //
:unsure_flag_subject_string: //
:log_to_allmail.txt: /no/
Mark the following for later tuning:
:good_threshold: /10.0/
:spam_threshold: /-5.0/
Now allow your decency filter user write-access to the config dir
chown -R mailuser:mailgroup /var/spool/crm114
=head2 TRAIN
Train your first mails into crm like this.
/usr/share/crm114/mailtrainer.crm --spam=/path/to/spamdir --good=/path/to/hamdir \
--fileprefix=/var/spool/crm114/
=head1 CLASS ATTRIBUTES
=cut
has cmd_check => (
is => 'rw',
isa => 'Str',
default => '/usr/share/crm114/mailreaver.crm --fileprefix=%user% -u %user% --report_only'
);
has cmd_learn_spam => (
is => 'rw',
isa => 'Str',
default => '/usr/share/crm114/mailfilter.crm --fileprefix=%user% -u %user% --learnspam'
);
has cmd_unlearn_spam => (
is => 'rw',
isa => 'Str',
default => '/usr/share/crm114/mailfilter.crm --fileprefix=%user% -u %user% --learngood'
);
has cmd_learn_ham => (
is => 'rw',
isa => 'Str',
default => '/usr/share/crm114/mailfilter.crm --fileprefix=%user% -u %user% --learngood'
);
has cmd_unlearn_ham => (
is => 'rw',
isa => 'Str',
default => '/usr/share/crm114/mailfilter.crm --fileprefix=%user% -u %user% --learnspam'
);
=head1 METHODS
=head2 handle_filter_result
=cut
sub handle_filter_result {
my ( $self, $result ) = @_;
my %header;
# parse result
my %parsed = map {
my ( $n, $v ) = /^X-CRM114-(\S+?):\s+(.*?)$/;
( $n => lc( $v ) );
} grep {
( run in 3.540 seconds using v1.01-cache-2.11-cpan-71847e10f99 )