Forward any e-mail to a resolved ticket to a different address

Hello everyone,

I recently started to take over a 12 year old RT 3.6.3 installation and am currently upgrading it to 4.4.4.
My knowledge about RT is limited but growing. I have knowledge in scripting and programming.

My users request the following feature:
When an e-mail is sent to a resolved (or rejected) ticket do not open the ticket back up and forward this mail to a different address.

I found code snippets regarding keeping a ticket resolved (or rejected) based on time in this thread:

I can remove the 7 day limitation and this should do the first part.
However how do I forward this mail to a known e-mail address?

Background:
We have around 40 supporters who might be out of office for multiple weeks. When a client re-opens a ticket the supporter is notified but might not read his mails for several weeks. Therefore we have a support inbox which is continuously monitored. Here we can take actions (re-assign to different supporter or open new ticket) in time.

Any help is greatly appreciated!
Thank you very much and best regards,
Andreas

Therefore we have a support inbox which is continuously monitored

This is an inbox, not an RT queue? It may be easier to allow the ticket to be re-opened and then either move the ticket to a support queue or send an email to the inbox mentioned above and have a link to the existing ticket.

The advantage of doing that would be that your supporter has access to the history of the ticket which could be useful.

Would this work? Or does the work-flow need to create a new email and leave the resolved ticket resolved?

Thank you for the fast reply craig!

More on the background:

  1. The issue is solved, a reply to the client is sent and the ticket marked resolved. After a day it is re-opened with “Thank you” by the client.
  2. The ticket was resolved long time ago. The client has a new issue (weeks, months, years later) and simply replies to the last known correspondence which references the ticket.

Yes, currently this is a separate e-mail inbox. We want our customers to contact us through this, rather than sending a mail to rt@… because we need certain custom fields to be entered before it can be processed further.

We would like to stay in charge of the number of tickets being opened. Therefore the “thank you” reply example shouldn’t open any ticket.
Resolved tickets are also forwarded to accounting and any additional time spent after billing wouldn’t be charged.

The intention of forwarding was something like:

Customer abc@def.com tried to answer to resolved ticket #12345. He wrote: “lorem ipsum”

Our first level support would have the reference to the ticket but stay in charge of opening the existing or a new ticket or to do something else.

Might it be an option to check if an email to rt@… references a valid ticket at all? If the ticket is unknown (e.g. subject is “help” instead of [rt… #12345]) or the referenced ticket is already resolved it would forward it?

Okay, thanks for the additional information.

First:

When an e-mail is sent to a resolved (or rejected) ticket do not open the ticket back up

The opening of a ticket when its resolved is done by the RT default scrip On Correspond Open Inactive Tickets. So you can either disable this scrip all together or create a new scrip with the same name at the queue level for the queue that these tickets are in and have it do nothing (this effectively turns the scrip off for only the one queue).

forward this mail to a different address.

Second, you can create a new scrip with a custom condition. In this condition, you just want the check if the status of the ticket is resolved and the transaction type is correspond. Then you can have a custom action or use something like the NotifyGroup action (Only member of that group would be your support inbox). The template for this outgoing email would then be a new one along the lines of:

Customer abc@def.com tried to answer to resolved ticket #12345. He wrote: “lorem ipsum”
1 Like

If someone finds this thread and has a similar request here is my final script:

my $ticket = $self->TicketObj;

return 0 unless $self->TransactionObj->Type eq "Correspond";

# Open the ticket if new or stalled
if (
($self->TicketObj->Status eq 'new') or
($self->TicketObj->Status eq 'stalled')
){
  my ($status, $msg) = $self->TicketObj->SetStatus('open');
  unless ( $status ) {
     $RT::Logger->error("Couldn't change status: $msg");
     return 0;
  } 
  return 1;
}

# Nothing else to do if not a resolved ticket
return 0 unless $self->TicketObj->Status eq 'resolved';

# If ticket is still in main queue just re-open it
if ($ticket->QueueObj->Name eq 'MAINQUEUE'){
  my ($status, $msg) = $self->TicketObj->SetStatus('open');
  unless ( $status ) {
     $RT::Logger->error("Couldn't change status: $msg");
     return 0;
  } 
  return 1;
}

# Create a new ticket and refer the closed one
my $transaction = $self->TransactionObj;
my $transaction_content_obj = $transaction->ContentObj;

my $child_ticket = RT::Ticket->new($RT::SystemUser);
my $user = RT::User->new($RT::SystemUser);
$user->Load($transaction->Creator);
my $mail = $user->EmailAddress;
my ($child_id, $child_TransObj, $errorMsg) =
    $child_ticket->Create(
                          Queue     => 'MAINQUEUE',
                          Subject   => 'Reopened: Ticket #'.$ticket->Id.': '.$ticket->Subject,
                          RefersTo  => $ticket->Id,
                          );

unless ($child_id) {
        $RT::Logger->debug(">>Error : ". $errorMsg);
        return undef
}

# Add a comment on the closed ticket with reference to the newly created ticket
$ticket->Comment(
                 Content => 'A new ticket was created in MAINQUEUE refering to this ticket: #'.$child_ticket->Id);

# Add a comment on the new ticket with the actual correspondence as comment
$child_ticket->Comment(Content => $transaction_content_obj->Content);

return 1;

Best regards,
Andreas