SpamScore2Priority: Difference between revisions

From Request Tracker Wiki
Jump to navigation Jump to search
m (2 revisions imported)
 
(No difference)

Latest revision as of 15:37, 6 April 2016

Unfortunately, RT hides a lot of message headers from the basic user interface, and so reviewing the few suspected spam messages that leak into your system can be rather tedious. Fortunately, you can use this scrip to alleviate some of this pain. The scrip below (currently setup for SpamAssassin style headers) will store an incoming email message's spam score as the ticket's initial priority. Thus a very spammy message might have a priority of -15, and questionable message might have a priorirty of -1; the system automagically handles any necessary casting. you can then occasionally review your Spam queue, sorting the messages by priority and paying the most attention to those with scores near zero.

  • Queue: Spam
  • Description: Spam score to negative priority
  • Condition: On Create
  • Action: User Defined
  • Template: Global: Blank
  • Stage: TransactionCreate
my $score = $self->TransactionObj->Attachments->First->GetHeader('X-Spam-Score');
unless( $score ){
    my $t = $self->TransactionObj->Attachments->First->GetHeader('X-Spam-Status');
    $t =~ /score=(-?\d+(|:\.\d+)?)/ && ($score = $1);
}
$self->TicketObj->SetPriority( -$score ) if $score;