Suppressing outgoing email from another queue if ticket is moved into our Spam queue

Hi,

We’re using 1b from http://wiki.bestpractical.com/view/SpamFiltering
and have also installed the disable global scrips extension to switch
of emails for this Spam queue.

The problem is as a ticket hits my support or sales queue etc. first,
an email is still being sent out. How can we disable this for detected
Spam so the notify emails get stopped?

Thanks.

http://www.suretecsystems.com/services/openldap/
http://www.suretectelecom.com

Hi,

We’re using 1b from http://wiki.bestpractical.com/view/SpamFiltering
and have also installed the disable global scrips extension to switch
of emails for this Spam queue.

The problem is as a ticket hits my support or sales queue etc. first,
an email is still being sent out. How can we disable this for detected
Spam so the notify emails get stopped?

So for example, once an email is filtered for the spam headers our MTA
has added, RT moves this ticket into our Spam queue. If this ticket
was meant for our sales queue, the sales queue still sends out an
email even though the end queue is our Spam one.

Here’s the condition:

Custom action preparation code:

my $inMessage = $self->TransactionObj->Attachments->First;
return 0 if ( !$inMessage ); # if no message attachment - assume web UI
return 0 if ( !$inMessage->GetHeader(‘Received’) ); # exit if not email message

if ( $inMessage->GetHeader(‘X-nohelo’)
|| $inMessage->GetHeader(‘X-badhelo’)
|| $inMessage->GetHeader(‘X-ptrmismatch’)
|| $inMessage->GetHeader(‘X-sendercalloutfail’)
|| $inMessage->GetHeader(‘X-rbl-spamhaus’)
|| $inMessage->GetHeader(‘X-rbl-spamcop’) )
{
return 1;
}
else { return 0; }

Custom action cleanup code:

my $newqueue = ‘Spam’;
my ( $status, $msg ) = $self->TicketObj->SetQueue($newqueue);
return $status ? undef : 1;

How can I switch off the email trigger for this match?

Thanks.

So for example, once an email is filtered for the spam headers our MTA
has added, RT moves this ticket into our Spam queue. If this ticket
was meant for our sales queue, the sales queue still sends out an
email even though the end queue is our Spam one.

I’m assuming that the email from your Sales queue is an auto-response or a ‘new ticket created’ email.

If that’s the case, then you’ll need your custom spam filter scrip to run first, before any of the email generating scrips run. IIRC, scrips are run in alphabetical order, so this may be as simple as prefixing the name of your spam filter scrip with a ‘0’ (zero). This should mean that spam tickets are moved to the Spam queue before any other action is taken and any of the email generating scrips which run, will run against the ticket in the Spam queue and not its original queue (e.g. Sales).

Next, you’ll need to stop the Spam queue from sending emails. You should be able to do this with template overrides. For every scrip which applies to the Spam queue (including global scrips) that sends email, copy the name of the template it uses and create a new template local to the Spam queue with the same name but with no contents. Queue-local templates will be used in preference to global templates and a blank template will not send any email.

Hope this helps.

Tom