MoveRTName

From Request Tracker Wiki
Jump to: navigation, search

To move the [rt.foo.com #1234] to the end of message subject lines, insert this code into your RT_SiteConfig.pm:

{

 use RT::Action::SendEmail;
 no warnings qw'redefine';

sub RT::Action::SendEmail::SetSubjectToken {

   my $self = shift;
   my $sub  = $self->TemplateObj->MIMEObj->head->get('Subject');
   my $id   = $self->TicketObj->id;
my $token_re = $RT::EmailSubjectTagRegex;
$token_re = qr/\Q$RT::rtname\E/o unless $token_re;
$sub =~ s/\[$token_re\s+#$id\]//;

$sub =~ s/(\r\n|\n|\s)/ /gi;
chomp $sub;
$sub = substr($sub,0,80);
$sub =~ s/\s*$//g;
$self->TemplateObj->MIMEObj->head->replace( Subject => "$sub [$RT::rtname #$id]",
);

}

 }

-- JesseVincent