For simple spam-check:

use strict;
use warnings;
package Test::Email::Classifier::Spam;
use base 'Email::Classifier';
sub default_tags { qw(test spam) }
sub default_type { 'spam' }
sub __allowed_args {}
sub consider {
  my ($self, $email) = @_;
  my $spam_status = $email->get_header('X-Spam-Status')
    or return $self->pass;
  if( $spam_status =~ /^yes/i ) {
      return $self->match({status => $spam_status});
  }
  return $self->pass;
}
1;

I'm looking at the code. It is different from what I did. And then I
spent a lot of time trying to incorporate the suggestions...

I still want to have methods dependent on the type of classifier. The
orig_message_id may have to scan the message, searching for the id. But
it should not have to do so if the message_id isn't going to be used.

Other examples are orig_message_head that should try to extract the
message_head from what ever format used. Maby giving access to classifier?

  my $report = $classifier->classify($email);
  if( $report->type eq 'dsn' )
  {
    print "DSN for ".$report->obj->orig_message_id;
  }



--
/ Jonas  -  http://paranormal.se/Jonas_Liljegren.html

Reply via email to