OnCreateAutoReplyException using the To: address?

I used the code from the wiki page at
http://wiki.bestpractical.com/view/OnCreateAutoReplyException to stop Auto
Replies from a list of addresses. This works great as it stops autoreplies
to certain requestors.

Now, I’d like to do something something similar, but checking the To:
address instead of the Requestor (From: or Reply-To:) address. The reason
being, there are a number of email groups already set up that blast messages
to entire groups, departments and even the dreaded ‘All Email Users’ list.
This ends up creating half a dozen new tickets for a single message sent to
a group which includes the RT queue addresses. Ideally, I’d like to catch a
message being sent to allusers@domain.com and delete the ticket right from
the Autoreply scrip, but for now I’m just trying to get it to not reply.

I borrowed some code from another wiki page (
http://wiki.bestpractical.com/view/AutomaticCustomFieldValue) that looks
like it does something similar (under CF values based on incoming To:
address), but it doesn’t seem to work for me:

On Create Autoreply to Requestors: use template autoreply

Custom condition:
my @exceptionList = (‘allemailusers@domain.com’,
‘mailer-daemon@rt.domain.com’,
‘postmaster@rt.domain.com’);

my $transactionType = $self->TransactionObj->Type;
my $ticketRequestor = lc($self->TicketObj->RequestorAddresses);
my $to =
lc($self->TicketObj->Transactions->First->Attachments->First->GetHeader(“To”));

if ($transactionType eq ‘Create’) {
return if grep { $ticketRequestor eq lc($) } @exceptionList;
return if grep { $to eq lc($
) } @exceptionList;
return 1;
}
return;

If anyone has any ideas on how to go about this, it would be much
appreciated.

  • Adam