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

Gene LeDuc gleduc at mail.sdsu.edu
Thu Nov 1 12:55:30 EDT 2007


I'm not sure whether it makes a difference, but "Subject" is a function, 
just like "Content".  Try using "Subject()" instead of "Subject".

At 09:38 AM 11/1/2007, Dorothea Muecke-Herzberg wrote:
>I simplified the template to:
>{
>   my $ToAddress = '<mailto:mycorp at dna.com>mycorp at dna.com';
>   my $FromAddress = $Ticket->CreatorObj->EmailAddress;
>   my $Subject .= $Ticket->Transactions->First->Subject;
>   $RT::Logger->debug("Subject is =$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";
>}
>
>The log says:
>
>[Thu Nov  1 16:01:40 2007] [debug]: Subject is == (template:5)
>
>So, yes, the original subject is not coming through. !?
>
>Doro
>
>
>
>
>
>----------
>From: Gene LeDuc [mailto:gleduc at mail.sdsu.edu]
>Sent: 01 November 2007 15:45
>To: Dorothea Muecke-Herzberg
>Cc: <mailto:rt-users at lists.bestpractical.com>rt-users at lists.bestpractical.com
>Subject: Re: FW: [rt-users] Possible to strip rtname from subject in 
>specific cases?
>
>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
>


-- 
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/fdd025a1/attachment.htm>


More information about the rt-users mailing list