[Rt-devel] Re: [PATCH] Improve RT::Interface::Email::Filter::SpamAssassin

Petter Reinholdtsen pere at hungry.com
Sun Aug 29 17:08:01 EDT 2004


[Petter Reinholdtsen]
> I had a look at the Filter::SpamAssassin mail plugin, and have a
> question and some suggested improvements.

On a related note, what about extending this filter to place suspected
spam messages into a configurable queue, making sure incorrectly
classified mails aren't lost.

Something like this would make this configurable.  Is this a usable
extention?

--- lib/RT/Interface/Email/Filter/SpamAssassin.pm       2004-04-30 00:26:36.000000000 +0200
+++ lib/RT/Interface/Email/Filter/SpamAssassin.pm       2004-08-29 23:05:50.000000000 +0200
@@ -33,7 +33,14 @@
     eval { $status->rewrite_mail() };
     if ($status->get_hits > $status->get_required_hits()*1.5) {
         # Spammy indeed
-        return (undef, -1);
+       if ($RT::SpamAssassinQueue) {
+           # Move to spam queue
+           $args{'Queue'}->Load( $RT::SpamAssassinQueue );
+       } else {
+           # tell Gateway() to drop the mail
+           $RT::Logger->info("SpamHeader: Dropping spam message!");
+           return ($args{CurrentUser}, -1);
+       }
     }
     return (undef, 0);
 }

One could also add several spam levels with associated actions/queues,
making it possible to throw away mail with very high spam score, and
queue in a special spam queue the mail with lower spam score.


More information about the Rt-devel mailing list