FW: [rt-users] Possible to strip rtname from subject in specific cases?

Gene LeDuc gleduc at mail.sdsu.edu
Thu Nov 1 11:44:52 EDT 2007


Hi Doro,

It sounds like the template isn't getting the original subject line from 
$Ticket->Transactions->First->Subject.  Try it without stripping the token 
and see what happens.  Replace
>   my $Subject = $RT::DisableSubjectToken;

with
     my $Subject = '"";

You can also use
    $RT::Logger->debug("Subject is =$Subject=");

to log what is happening.

This will help focus the problem area.

Gene

At 05:28 PM 10/31/2007, Dorothea Muecke-Herzberg wrote:
>Thank you all very much for your pointers. I've decided to implement the 
>SendEmail overlay from Gene, because it seems to give me exactly what I need.
>
>Gene, I've got it almost working, my only problem is that the original 
>subject line gets stripped as well, only the prefix part of the subject 
>from my template gets through.
>
>
>My template is:
>{
>   my $ToAddress = '<mailto:dtb at dummy.org>dtb at dummy.org';
>   my $FromAddress = $Ticket->CreatorObj->EmailAddress;
>   my $Subject = $RT::DisableSubjectToken;
>   $Subject .= 'dummy' . $Ticket->Transactions->First->Subject;
>   my $Content = $Ticket->Transactions->First->Content();
>   $OUT = "From: $FromAddress\n";
>   $OUT .= "To: $ToAddress\n";
>   $OUT .= "Reply-To: $FromAddress\n";
>   $OUT .= "Subject: $Subject\n\n";
>   $OUT .= "$Content\n";
>}
>
>SendEmail_Local.pm looks like this:
>
>use strict;
>no warnings qw(redefine);
>
>sub SetSubjectToken {
>     my $self = shift;
>     my $tag  = "[$RT::rtname #" . $self->TicketObj->id . "] ";
>     my $sub  = $self->TemplateObj->MIMEObj->head->get('Subject');
>     my $no_rt_flag = $RT::DisableSubjectToken if $RT::DisableSubjectToken;
>
>     unless ( $sub =~ /\Q$tag\E/ ) {
>         $sub =~ s/(\r\n|\n|\s)/ /gi;
>         chomp $sub;
>
>         if ( $no_rt_flag && $sub =~ /^\Q$no_rt_flag\E/ ) {
>           $sub =~ s/(\Q$no_rt_flag\E)//;
>           $tag = '';
>         }
>         $self->TemplateObj->MIMEObj->head->replace( 'Subject', $tag . $sub );
>     }
>}
>
>1;
>
>And the email header is:
>
>From: <mailto:dmh at ngat.com>dmh at ngat.com
>To: <mailto:lco at kdna.com>lco at kdna.com
>Reply-To: <mailto:dmh at ngat.com>dmh at ngat.com
>Subject: dummy
>
>Somewhere the original subject gets lost. Any ideas why?
>
>(I am running RT 3.6.5)
>
>Thanks,
>
>Doro


-- 
Gene LeDuc, GSEC
Security Analyst
San Diego State University 
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.bestpractical.com/pipermail/rt-users/attachments/20071101/0e91a361/attachment.htm>


More information about the rt-users mailing list