MultipleSubjectTokens: Difference between revisions

From Request Tracker Wiki
Jump to navigation Jump to search
m (2 revisions imported)
 
(No difference)

Latest revision as of 15:15, 6 April 2016

MultipleSubjectTokens

It is easy to accept multiple tokens on incoming email, simply use EmailSubjectTagRegex For setting different tokens on outgoing emails depending on the queue name, put the following routine into SendEmail_Local.pm (in the example the tag for queuename 'other' is set to 'OTHER-TAG'):

sub SetSubjectToken {
   my $self = shift;
   my $tag  = "[$RT::rtname #" . $self->TicketObj->id . "]";
   my $othertag  = "[OTHER-TAG #" . $self->TicketObj->id . "]";
   my $sub  = $self->TemplateObj->MIMEObj->head->get('Subject');
   unless ( $sub =~ /\Q$tag\E/ ) {
       $sub =~ s/(\r\n|\n|\s)/ /gi;
       chomp $sub;
       if ($self->TicketObj->QueueObj->Name =~ /OTHER/) {
         $self->TemplateObj->MIMEObj->head->replace( 'Subject', "$othertag $sub" );
       } else {
         $self->TemplateObj->MIMEObj->head->replace( 'Subject', "$tag $sub" );
       }
   }
}

return 1;