References header missing on AutoreplyOnResolve

Hello,

I’m using RT 3.6.3 at my work and I need some help and/or explanation.
When a ticket is closed, we want to send a mail to the requestor. A
classic behaviour of RT.
I noticed that the References header aren’t set properly on mails sent by
RT himself. I need this absolutely.

A user send a mail to open a new ticket :
The Message-ID looks like :
lv.xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx.xxxxxx@domain.com

When a user reply to the requestor through RT, the References header is
set properly.
The Message-ID looks like :
rt.xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx.xxxxxx@domain2.org

When the same user close the ticket, the mail sent by RT to notify the
requestor that his ticket is closed doesn’t contain the references header.
The Message-ID looks like :
rt.xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx.xxxxxx@domain2.org

domain2.org is set in the RT_SiteConfig.pm
Set($Organization , “domain2.org”);

I’ve seen in the rt3/lib/RT/Action/SendEmail.pm that the code involved for
setting References header is the following :

sub SetReferencesHeaders {

# There are two main cases -- this transaction was created with
# the RT Web UI, and hence we want to *not* append its Message-ID
# to the References and In-Reply-To.  OR it came from an outside
# source, and we should treat it as per the RFC
if ( "@msgid" =~ /<(rt-.*?-\d+-\d+)\.(\d+-0-0)\@$RT::Organization>/) {

  # Make all references which are internal be to version which we
  # have sent out
  for (@references, @in_reply_to) {
    s/<(rt-.*?-\d+-\d+)\.(\d+-0-0)\@$RT::Organization>$/
      "<$1." . $self->TicketObj->id .
         "-" . $self->ScripObj->id .
         "-" . $self->ScripActionObj->{_Message_ID} .
         "@" . $RT::Organization . ">"/eg
  }

  # In reply to whatever the internal message was in reply to
  $self->SetHeader( 'In-Reply-To', join( " ",  ( @in_reply_to )));

  # Default the references to whatever we're in reply to
  @references = @in_reply_to unless @references;

  # References are unchanged from internal
} else {
  # In reply to that message
  $self->SetHeader( 'In-Reply-To', join( " ",  ( @msgid )));

  # Default the references to whatever we're in reply to
  @references = @in_reply_to unless @references;

  # Push that message onto the end of the references
  push @references, @msgid;
}

}

I’m not experienced in perl so… I can’t figure out what’s wrong with
this References header. How can I resolve this please?