Remove/Disallow CCs from ticket on creation?


Could anybody please send me an example, documentation, or guidance on:

How to remove CCs from a ticket on creation, when the email address
doesn’t match a regular expression?


You could disable the $ParseNewMessageForTicketCcs config option if you do not want any Cc’s automatically added to the ticket.

Using a regex, you could create a RT::Scrip that runs On Create and checks the Cc’s on the ticket and if they shouldn’t be there you can use the DeleteWatcher method.


Thanks for your response. Here’s what I have so far, but I’m unsure if it will actually work.

# Custom Condition:
# If the creator matches a regular expression
# then we need to remove the Ccs from this ticket
my $EmailAddr = $self->TransactionObj->CreatorObj->EmailAddress;
return 1 if ($EmailAddr =~ m/\.some-address\.domain\.edu$/);

# Custom action preparation code:
return 1;

# Custom action commit code
my $ticket = $self->TicketObj;
my $rt_group = $ticket->Cc();
my $members = $rt_group->MembersObj();

while (my $member = $members->Next())
	# I'm unsure if this is how to delete the watcher
	$ticket->DeleteWatcher('Principal' => $member->id());