FW: FW: Possible to strip rtname from subject in specific cases?

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@dna.commycorp@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@mail.sdsu.edu]
Sent: 01 November 2007 15:45
To: Dorothea Muecke-Herzberg
Cc: mailto:rt-users@lists.bestpractical.comrt-users@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@dummy.orgdtb@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@ngat.comdmh@ngat.com
To: mailto:lco@kdna.comlco@kdna.com
Reply-To: mailto:dmh@ngat.comdmh@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